Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Running @Script.sql from inside C#

720551Oct 20 2009 — edited Mar 3 2010
I'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.
This post has been answered by 728495 on Oct 21 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 31 2010
Added on Oct 20 2009
6 comments
8,864 views