程序名称:AGENCY_STATE_REPORT
输入:
(frm_date date,
to_date1 date)
输出;
p_cur out SYS_REFCURSOR
我的 C# 代码:
public DataTable retdt1(string frmdate,string todate)
{
try
{
// Logfile("retdt", query);
con.Open();
if (con.State == ConnectionState.Open)
{
objCmd = new OracleCommand();
objCmd.CommandText = "AGENCY_STATE_REPORT ";
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.Add("@frm_date",OracleDbType.Date).Value=frmdate;
objCmd.Parameters.Add("to_date1", OracleDbType.Date).Value = todate;
objCmd.Parameters["@ p_cur"].Direction = ParameterDirection.Output;
dap = new OracleDataAdapter(objCmd);
dt = new DataTable();
dap.Fill(dt);
if (dt.Rows.Count > 0)
{
return dt;
}
}
return null;
}
catch (Exception ex)
{
HttpContext.Current.Response.Write(ex.Message);
throw ex;
}
finally
{
if (con != null)
if (con.State != ConnectionState.Closed)
con.Close();
if (objCmd != null)
{
objCmd.Dispose();
dap.Dispose();
dt.Dispose();
}
}
}
我知道这是错误的代码,但是如何将这两个输入参数发送到存储过程?