Send sp parameters regardless of sequence
-
Hi, all would you please show me how to call following sp from asp.net say the TEST sp is as follows takes the following parameters: @ID , @MeetingID, @Title how can I call this from c# (code behind file) in the folowing fashion TEST @ID=intID,@MeetingID=intMID,@Title=strTitle or TEST @Title=strTitle,@ID=intID,@MeetingID=intMID or TEST @Title=strTitle,@MeetingID=intMID,@ID=intID NOTE: All of these statement execute successfully from query analyzer. Thanks in advance.
-
Hi, all would you please show me how to call following sp from asp.net say the TEST sp is as follows takes the following parameters: @ID , @MeetingID, @Title how can I call this from c# (code behind file) in the folowing fashion TEST @ID=intID,@MeetingID=intMID,@Title=strTitle or TEST @Title=strTitle,@ID=intID,@MeetingID=intMID or TEST @Title=strTitle,@MeetingID=intMID,@ID=intID NOTE: All of these statement execute successfully from query analyzer. Thanks in advance.
Just add the parameters below As it is a store procedure all you have to do is to send the params to the SP..!
public static bool Update_Driver(int ID, int MeetingID, string Title)
{bool result = false; SqlCommand command = new SqlCommand("Your Store ProcedureName", YourConnection); command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@ID", ID); command.Parameters.AddWithValue("@MeetingID", MeetingID); command.Parameters.AddWithValue("@Title", Title); command.Connection.Open(); // result = Convert.ToBoolean(Command.ExecuteNonQuery()); try { result = Convert.ToBoolean(command.ExecuteNonQuery()); } catch (Exception ie) { } command.Connection.Close(); command.Connection.Dispose(); return result; }
LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.