Click here to Skip to main content
11,704,001 members (66,088 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASM MySQL
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 19-Apr-13 1:30am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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

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

  Print Answers RSS
0 Maciej Los 530
1 OriginalGriff 510
2 Sergey Alexandrovich Kryukov 421
3 Andy Lanng 294
4 F-ES Sitecore 220
0 OriginalGriff 8,744
1 Sergey Alexandrovich Kryukov 7,747
2 CPallini 5,107
3 Maciej Los 4,716
4 Mika Wendelius 3,606


Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 19 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100