I have written SQL scripts in a script.sql
file to create procedures. This script.sql
file is located in the application path.
Now I've written a tool in C# that creates a database connection. I would like to run the script file with code through this connection. Is that possible?
private OracleConnection oraCon = new OracleConnection();
...
// ORACLE VERBINDUNG
try
{
if (oraCon.State != ConnectionState.Open)
{
oraCon.ConnectionString = "Data Source=" + tboServername.Text + "/" +
tboDatenbank.Text + ";User Id=" + tboLogin.Text + ";Password=" + tboPasswort.Text;
oraCon.Open();
}
}
catch (Exception ex)
{
Errorlog(ex.ToString());
}
Can I transfer the script.sql
directly to the OraCon connection? Or maybe there is another way?