SqlConnection conn = new SqlConnection("CONNECTION HERE"); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_abc"; //Create the first parameter SqlParameter firstParam = new SqlParameter("P_Id", SqlDbType.Int); firstParam.Value = 0; //Place your variable firstParam.Direction = ParameterDirection.Input; cmd.Parameters.Add(firstParam); //Parameter 1 //Create the second parameter SqlParameter secondParam = new SqlParameter("ResultRS", SqlDbType.Variant); secondParam.Direction = ParameterDirection.Output; cmd.Parameters.Add(secondParam); //Parameter 2 int count = cmd.ExecuteNonQuery(); Console.WriteLine(secondParam.Value.ToString()); This is correct now, secondParam.Value and you read the value News at http://support.microsoft.com/kb/308621[^]
modified on Monday, January 07, 2008 8:36:36 AM