asp.net(c#) 调用存储过程,获取输出参数和记录集
using (OleDbCommand comm = new OleDbCommand())
{
comm.Connection = conn;
comm.CommandType = CommandType.StoredProcedure;
comm.CommandText = "p_getboardinfo ";
comm.Parameters.Add( "p_userid ", OleDbType.VarChar, 40);
comm.Parameters[ "p_userid "].Value = null;
comm.Parameters.Add( "p_departid ", OleDbType.VarChar, 40);
comm.Parameters[ "p_departid "].Value = 0;
comm.Parameters.Add( "p_startpage ", OleDbType.Numeric, 10);
comm.Parameters[ "p_startpage "].Value = 1;
comm.Parameters.Add( "p_pagenum ", OleDbType.Numeric, 10);
comm.Parameters[ "p_pagenum "].Value = 3;
comm.Parameters.Add( "r_count ", OleDbType.Numeric, 10);
comm.Parameters[ "r_count "].Direction = ParameterDirection.Output;
//comm.ExecuteNonQuery();
OleDbDataReader dr = comm.ExecuteReader();
foreach (OleDbParameter parameter in comm.Parameters)
{
Response.Write(string.Format( "参数名:{0},参数方向:{1},参数值:{2} <br/> ", parameter.ParameterName, parameter.Direction.ToString(), parameter.Value));