using LOAD DATA INFILE with VB Express 2010 A First Chance Exception
I am using mysql connector 6.4.x with vb 2010 express. I can open a connection and read a table using mysqlconnection, so that is not a problem. My real work is to bulkload files into the database. here is the sql code that i am using
StrSQL = "LOAD DATA INFILE '" & strSourceFile & "' into table " & strTableName & " fields terminated by '|' lines terminated by '\n' ignore 1 lines " & _
"(@TradeDate,Hub, Product, @Strip, Contract, ContractType, @Strike, SettlementPrice, @NetChange, @Expiration_Date, Product_ID) " & _
"set TradeDate = str_to_date(@TradeDate,'%m/%d/%YYYY'), Strip = str_to_date(@Strip, '%m/%d/%YYYY'), ExpirationDate = str_to_date(@Expiration_Date, '%m/%d/%YYYY')"
Dim Cmd2 As New MySqlCommand(StrSQL, Conn)
Try
Cmd2.ExecuteNonQuery()
Catch ex As Exception
At this point it comes up with an error
A first chance exception of type 'MySql.Data.MySqlClient.MySqlException' occured in MySql.Data.dll
This is the StrSQL generated within the program (debug message)
LOAD DATA INFILE 'H:/HistoricalDataFiles/2011_07_08.dat' into table FixedPrice fields terminated by '|' lines terminated by '\n' ignore 1 lines (@TradeDate,Hub, Product, @Strip, Contract, ContractType, @Strike, SettlementPrice, @NetChange, @Expiration_Date, Product_ID) set TradeDate = str_to_date(@TradeDate,'%m/%d/%YYYY'), Strip = str_to_date(@Strip, '%m/%d/%YYYY'), ExpirationDate = str_to_date(@Expiration_Date, '%m/%d/%YYYY')
Any help in solving this would be appreciated.
thank you.