0

This simple code returns a 'fatal execution error', but the same query runs perfectly fine when executed directly in MySQL:

SQL = "LOAD DATA INFILE 'D:\\Shared\\Berlin Stock Exchange\\0002.BE#CLP HOLDINGS ORD (M).csv'  INTO TABLE prices FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n'  IGNORE 1 LINES  (@col1,@col2,@col3,@col4,@col5,@col6,@col7,@col8) SET `symbol`=@col1,`int`=@col2,`date`=STR_TO_DATE(@col3,'%m/%d/%Y %h:%i:%s %p'), `close`=@col7;"
cmd = New MySqlCommand(SQL, conn)
cmd.CommandTimeout = 0
cmd.ExecuteNonQuery()                

What am I missing here?

Thanks!

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360
user2723490
  • 2,010
  • 4
  • 27
  • 37
  • Possibly relevant: https://stackoverflow.com/questions/12834675/load-data-infile-with-variables – Tim Biegeleisen Oct 12 '17 at 00:01
  • Tim, thank you - you are right. Adding ';Allow User Variables=True' to the connection string did the trick. Please post the answer and I will accept it as a solution. Thanks! – user2723490 Oct 12 '17 at 00:31

0 Answers0