Running @Script.sql from inside C#
720551Oct 20 2009 — edited Mar 3 2010I'm trying to include a script file as part of a deployment. I'm able to connect to my Oracle XE database in code and run stored procedures as well as text commands. My deployment will copy a script file into an install directory for later use. When the user activates history recording, I want to run this script file.
I can run the script manually...@"C:\Program Files\History Setup\TestScript.sql"...without issue. Works just fine.
Currently I recieve an invalid sql command error. At the moment I'm trying:
Command.Connection = myconnection;
Command.CommandText = @"@""C:\Program Files\History Setup\TestScript.sql""";
Command.CommandType = CommandType.Text;
try
{
Connection.Open();
Command.ExecuteNonQuerry;
}
catch (Exception ex)
{
error handling
}
If anyone has advice for running script files from inside C#, it would be appreciated.