string str = "Data Source=.;Initial Catalog=***;Integrated Security=True";
using (SqlConnection conn = new SqlConnection(str))
{
string sql = @"DECLARE @PCOUNT INT,@TCOUTN INT,@ReturnVal INT;
EXEC @ReturnVal = [proc_LogList] 'admin','删除',1,12,@TCOUTN OUTPUT,@PCOUNT OUTPUT;
SELECT @ReturnVal,@TCOUTN,@PCOUNT"; SqlCommand cmd = new SqlCommand(sql, conn);
conn.Open();
SqlDataReader sdr = cmd.ExecuteReader();
sdr.NextResult();
if (sdr.Read())
{
Console.WriteLine(sdr[]);
}
sdr.Close();
sdr.Dispose();
}

DATASET接收或datareader接收都可。

05-11 21:45