Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return values from SQL Stored Procedure

Status
Not open for further replies.

kyledunn

Programmer
Jan 2, 2001
145
0
0
US
I have successfully passed parameters to an SQL stored procedure using the SQLDataSetCommand and the InsertCommand:

DSCmd = new SQLDataSetCommand(sCommand, sConn);

(sCommand was my select statement and sConn was my connection string)

DSCmd.InsertCommand.ActiveConnection = objConn;

DSCmd.InsertCommand.CommandType = CommandType.StoredProcedure;

DSCmd.InsertCommand.CommandText = "Name_of_Stored_Procedure"

DSCmd.InsertCommand.Parameters.Add(new SQLParameter("@Data", SQLDataType.VarChar, 10));

DSCmd.InsertCommand.Parameters["@Data"].Value = "The data being sent to the stored procedure";

DSCmd.InsertCommand.ExecuteNonQuery();

Question: Can anyone on the forum tell me the code for returning results from the stored procedure to a variable in the C# program?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top