Ado.net executes the oracle Stored Procedure
The oracle stored procedure in ado.net is as follows:
OracleConnection con = new OracleConnection (strcon );
OracleCommand cmd = new OracleCommand ();
OracleTransaction mytrans;
Try
{
Con. Open ();
Mytrans = con. BeginTransaction ();
Cmd. Connection = con;
Cmd. CommandText = "rfgetid ";
Cmd. CommandType = CommandType. StoredProcedure;
Cmd. Transaction = mytrans;
OracleParameter parameter_in = new OracleParameter ("as_bm", OracleType. Char );
OracleParameter parameter_out = new OracleParameter ("as_sxh", OracleType. Number );
Parameter_in.Direction = ParameterDirection. Input;
Parameter_out.Direction = ParameterDirection. Output;
Parameter_in. Value = tblname. ToUpper ();
Cmd. Parameters. Add (parameter_in );
Cmd. Parameters. Add (parameter_out );
Cmd. ExecuteNonQuery ();
Mytrans. Commit ();
Return int. Parse (parameter_out. Value. ToString ());
}
Catch (Exception er)
{
Throw new Exception (er. Message );
Mytrans. Rollback ();
}
Finally
{
Cmd. Dispose ();
Con. Close ();
}