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?
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?