Executecommand issue
Posted: Thu 04 Aug 2011 17:16
Hi there!
I'm trying to execute a custom SQL statment. A "LOAD DATA INFILE" to be more exact.
The problem is that if I use a hardcoded path to the file, everything works. But if I use a variable path, it does not.
For exemple:
this snipped works
this on the other hand does not
When I look the exception, it says that it could not find file D:EconECONCPAServerbin\Releaseoccurrences.sql
What is going on here? Am I doing something stupid and not even seeing it?
Thanks
I'm trying to execute a custom SQL statment. A "LOAD DATA INFILE" to be more exact.
The problem is that if I use a hardcoded path to the file, everything works. But if I use a variable path, it does not.
For exemple:
this snipped works
Code: Select all
string command = @"LOAD DATA INFILE 'D:\Econ\ECONCPAServer\bin\Release\occurrences.sql' INTO TABLE occurrence FIELDS TERMINATED BY ';';
dc.ExecuteCommand(command);
this on the other hand does not
Code: Select all
string workingFile = string.Format(@"{0}\occurrences.sql", Environment.CurrentDirectory);
string command = string.Format(@"LOAD DATA INFILE '{0}' INTO TABLE occurrence FIELDS TERMINATED BY ';'", workingFile);
dc.ExecuteCommand(command);
What is going on here? Am I doing something stupid and not even seeing it?
Thanks