2014-03-28 47 views
0

我在我的節目MYSQL命令字符串被切斷

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

在看看這裏 - 如何把含雙引號數據字符串變量 http://stackoverflow.com/questions/ 7767037/how-to-put-data-containing-double-quotes-in-string-variable – Abhith

+0

謝謝先生@Abhith它的工作! – carlot0820

回答

-1

嘗試逃脫與字符「\」雙引號:

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

這在VB.Net中不起作用。 –