Sql query results in Errcode: 22
Hey Everybody,
i got a new problem and the search in support/board and google didn't help that much.
I got following code snippet based on this example --> http://support.smartbear.com/viewarticle/58247/
var Qry = ADO.CreateADOQuery(); Qry.ConnectionString = "Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=test;Uid=uid;Pwd=pwd;"; Qry.SQL = "LOAD DATA LOCAL INFILE '" + ExportFileName + "' INTO TABLE `testlogs` FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'"; Qry.Open(); Qry.Close();
But when the code is executed an error occurs:
[MySQL][ODBC 5.1 Driver][mysqld-5.1.41]File 'C:Users egtestDocumentsTest for Logs' not found (Errcode: 22)
After hours of searching and trying (i had the problem already 2 days ago) i found the solution.
While creating the file as described here --> http://support.smartbear.com/viewarticle/55140/?utm_source=site-search&utm_medium=search-results&utm_campaign=site-search-c&utm_term=scripting+access&_ga=1.168507046.621782120.1429251315
i used the double backslashes for the path.
Since the path of the file is being saved with just one backslash the query couldn't find the file i defined in 'ExportFileName'.
So i changed the backslashes for slashes and everything works fine.