正在剪切MYSQL命令字符串

时间:2014-03-28 06:40:48

标签: mysql vb.net

我的程序上有这段代码

strSQL = "load data local infile 'C:/csv.csv' replace into table student_records fields terminated by ',' enclosed by '"' lines terminated by '\r\n'"

但它认为的字符串只有"load data local infile 'C:/csv.csv' replace into table student_records fields terminated by ',' enclosed by '"

,这被视为评论' lines terminated by '\r\n'"

字符串由双引号终止,但它仍然是我的mysql命令的一部分。

你能告诉我如何做到这一点吗?

我正在尝试自动更新表格中的数据。

1 个答案:

答案 0 :(得分:-1)

尝试使用" \"转义双引号字符:

strSQL = "load data local infile 'C:/csv.csv' replace into table student_records fields terminated by ',' enclosed by '\"' lines terminated by '\r\n'"