First, create a stored procedure in SQL Server, divided into parameters and no parameters in the time of call, first brief introduction to the situation where the parameters are not parameters: Suppose the stored procedure is as follows: Create Proc selectall as select * from studentin, this SP the call follows: SqlCommand selectCMD = new SqlCommand ( "SelectAll", conn); // conn is SqlConnection selectCMD.CommandType = CommandType.StoredProcedure; if the result set needs to be added to a DataAdapter, may be as follows: SqlDataAdapter stuDA = new SqlDataAdapter (); stuDa.SelectCommand = selectCMD; if there are parameters: create proc andSelect @StudentId varchar (10), @StudentName varchar (10), as Select * from StudentInf where StudentId = @StudentId and StudentName = @StudentName the parameters may be as follows Add: Selectcmd.Parameters.add ("@ studentid", sqldbtype.nvarchar, 10); selectcmd.parameters.add ("@ studentname", sqldbtype.nvarchar, 10); if there is only one parameter, you can assign a value: Sqlparameters Onepara = Selectcmd.Parameters.Add ("@ studentid", sqldbtype.nvarchar, 10); Onepara.Value = "a string"