Click here to Skip to main content
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 2: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 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,142
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 19 Apr 2013
Copyright © CodeProject, 1999-2014
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