c# Parameters.Add
的有关信息介绍如下:SqlConnection nwindConn = new SqlConnection("Data Source=localhost;Integrated Security=SSPI;Initial Catalog=northwind"); SqlCommand salesCMD = new SqlCommand("SalesByCategory", nwindConn);salesCMD.CommandType = CommandType.StoredProcedure; SqlParameter myParm = salesCMD.Parameters.Add("@CategoryName", SqlDbType.NVarChar, 15);myParm.Value = "Beverages"; nwindConn.Open(); SqlDataReader myReader = salesCMD.ExecuteReader(); Console.WriteLine("{0}, {1}", myReader.GetName(0), myReader.GetName(1)); while (myReader.Read()){ Console.WriteLine("{0}, ${1}", myReader.GetString(0), myReader.GetDecimal(1));} myReader.Close();nwindConn.Close();