我的程序上有这段代码
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命令的一部分。
你能告诉我如何做到这一点吗?
我正在尝试自动更新表格中的数据。
答案 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'"