ado.net执行oracle 存储过程如下:
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 ();
}
更多信息请查看IT技术专栏