Issuing a PLSQL command from c#

  • Thread starter Thread starter Randy
  • Start date Start date
R

Randy

Hello,
I'm trying to find out if it is possible, and if so...how to accomplish
issuing a PLSQL command from within C#. The command is...
SET SCAN OFF;
What is happening is I'm trying to insert/update records with strings which
contain "&" (this causes a prompt in oracle for a parameter) and this causes
the query to fail in C#. I need to turn it off just for my application and
then turn it back on after updating.
I need to be able to do this from within my application and I can't make
anything work.
Can this be done?

Thanks
 
Randy,

You should be able to issue the command through the OleDbCommand class,
or through the OracleCommand class (depending on the provider you are
using). While I am not that specific with Oracle, I would think you would
have to issue it once for each open connection though.

Hope this helps.
 
Thanks...Yes...I tried issuing it through the OracleCommand class using the
ExecuteNonQuery but it still fails. I'm not sure which exact method in this
class I should use or if there's any special formatting of the command
string I need to do.

Nicholas Paldino said:
Randy,

You should be able to issue the command through the OleDbCommand class,
or through the OracleCommand class (depending on the provider you are
using). While I am not that specific with Oracle, I would think you would
have to issue it once for each open connection though.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Randy said:
Hello,
I'm trying to find out if it is possible, and if so...how to accomplish
issuing a PLSQL command from within C#. The command is...
SET SCAN OFF;
What is happening is I'm trying to insert/update records with strings
which contain "&" (this causes a prompt in oracle for a parameter) and
this causes the query to fail in C#. I need to turn it off just for my
application and then turn it back on after updating.
I need to be able to do this from within my application and I can't make
anything work.
Can this be done?

Thanks
 
Hi,

How fails?

It depends of the scope of "SET SCAN OFF" construction, if it's based on
the session , it will be active while you have the connection open, if it's
reset each time you issue a new command, well that is a problem

Just to be sure, can you send two SQL instructions in one command:
theOracleComamnd.CommandText = " SET SCAN OFF; UPDATE TABLE ... ; " ?


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation



Randy said:
Thanks...Yes...I tried issuing it through the OracleCommand class using
the ExecuteNonQuery but it still fails. I'm not sure which exact method in
this class I should use or if there's any special formatting of the
command string I need to do.

Nicholas Paldino said:
Randy,

You should be able to issue the command through the OleDbCommand
class, or through the OracleCommand class (depending on the provider you
are using). While I am not that specific with Oracle, I would think you
would have to issue it once for each open connection though.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Randy said:
Hello,
I'm trying to find out if it is possible, and if so...how to accomplish
issuing a PLSQL command from within C#. The command is...
SET SCAN OFF;
What is happening is I'm trying to insert/update records with strings
which contain "&" (this causes a prompt in oracle for a parameter) and
this causes the query to fail in C#. I need to turn it off just for my
application and then turn it back on after updating.
I need to be able to do this from within my application and I can't make
anything work.
Can this be done?

Thanks
 
I don't think you can send two commands at once...

Ignacio Machin ( .NET/ C# MVP ) said:
Hi,

How fails?

It depends of the scope of "SET SCAN OFF" construction, if it's based on
the session , it will be active while you have the connection open, if
it's reset each time you issue a new command, well that is a problem

Just to be sure, can you send two SQL instructions in one command:
theOracleComamnd.CommandText = " SET SCAN OFF; UPDATE TABLE ... ; " ?


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation



Randy said:
Thanks...Yes...I tried issuing it through the OracleCommand class using
the ExecuteNonQuery but it still fails. I'm not sure which exact method
in this class I should use or if there's any special formatting of the
command string I need to do.

Nicholas Paldino said:
Randy,

You should be able to issue the command through the OleDbCommand
class, or through the OracleCommand class (depending on the provider you
are using). While I am not that specific with Oracle, I would think you
would have to issue it once for each open connection though.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hello,
I'm trying to find out if it is possible, and if so...how to accomplish
issuing a PLSQL command from within C#. The command is...
SET SCAN OFF;
What is happening is I'm trying to insert/update records with strings
which contain "&" (this causes a prompt in oracle for a parameter) and
this causes the query to fail in C#. I need to turn it off just for my
application and then turn it back on after updating.
I need to be able to do this from within my application and I can't
make anything work.
Can this be done?

Thanks
 
Back
Top