开发者

C# cannot handle paramized query MySQl Administrator vs. Visual Studio

I've a question, when I use a sql command to set up a LOAD DATA LOCAL INFILE query in C#, I need to format the date (from 11/11/2000 to 2000/11/11). So I need a "@" to fix the format:

LOAD DATA LOCAL INFILE 'test_123.csv'

INTO TABLE test_123

FIELDS TERMINATED BY ','

IGNORE 1 LINES

(@Date, column1, column2, ...)

SET date = str_to_date(@Date, '%m/%d/%Y')

When I execute the query in MySQL administrator, it works fine. When I declare this in c#, he gives a fatal error exception because the "@" is used to declare a sql parameter (The error says: "You need to define the @Date parameter"). I think this is a tricky one, can you help me with this problem?

Thanks in advance! Thi开发者_运维百科js


I found no solution for this problem, I tried enough (I certainly tried not all of the options). My solution now is rather slow and ugly, first I loop trough the CSV and format the dates correctly, than I execute the query, but this solution totally misses the point of the load data infile.

If somebody knows a solution for this problem, feel free to post ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜