Click here to Skip to main content
15,886,038 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sir why it not work when there is no syntax error.Here my (string insquery = "INSERT INTO sla (month, year, contenttype) VALUES(@month, @year, @contenttype)";) that query work fine but why it will not work (LOAD DATA INFILE " + path + " INSERT INTO TABLE sla1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 LINES)


and given error......
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'D:\Book1111.csv INSERT INTO TABLE sla1 FIELDS TERMINATED BY ',' LINES TERMINATE' at line 1

And code is previsouly send to you.


Please give a solution.............
Posted

1 solution

Try adding quotes:
SQL
LOAD DATA INFILE " + path + " INSERT INTO TABLE sla1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 LINES
Becomes
SQL
LOAD DATA INFILE '" + path + "' INSERT INTO TABLE sla1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 LINES
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900