I have a form that is updating site information in a MS SQL database via an SQLCommand and a stored procedure. When I run the stored procedure from the server explorer, supplying the parameters myself, it works fine, so I know the sp is not the culprit. Any suggestions for how I might go about debugging this bit of code, which is executed in the OnClick of the Update button? The update does not seem to take place when I attempt to run the sp using the button, but I know at least that the code is being executed.
Thanks,
T
SqlConnection conn = get_sqlconnection();
SqlCommand Cmd = new SqlCommand ("[updSite]", conn);
Cmd.CommandType = CommandType.StoredProcedure;
Cmd.Parameters.Add(New SqlParameter("@id", SqlDbType.Int))
Cmd.Parameters(0).Value = Request.QueryString.Get("id")
Cmd.Parameters.Add(New SqlParameter("@name", SqlDbType.VarChar))
Cmd.Parameters(1).Value = txtName.Text
Cmd.Parameters.Add(New SqlParameter("@address1", SqlDbType.VarChar))
Cmd.Parameters(2).Value = txtAddr1.Text
Cmd.Parameters.Add(New SqlParameter("@address2", SqlDbType.VarChar))
Cmd.Parameters(3).Value = txtAddr2.Text
Cmd.Parameters.Add(New SqlParameter("@city", SqlDbType.VarChar))
Cmd.Parameters(4).Value = txtCity.Text
Cmd.Parameters.Add(New SqlParameter("@state", SqlDbType.VarChar))
Cmd.Parameters(5).Value = mnuState.SelectedItem.Value
Cmd.Parameters.Add(New SqlParameter("@zip", SqlDbType.VarChar))
Cmd.Parameters(6).Value = txtZip.Text
Cmd.ExecuteNonQuery()
Thanks,
T
SqlConnection conn = get_sqlconnection();
SqlCommand Cmd = new SqlCommand ("[updSite]", conn);
Cmd.CommandType = CommandType.StoredProcedure;
Cmd.Parameters.Add(New SqlParameter("@id", SqlDbType.Int))
Cmd.Parameters(0).Value = Request.QueryString.Get("id")
Cmd.Parameters.Add(New SqlParameter("@name", SqlDbType.VarChar))
Cmd.Parameters(1).Value = txtName.Text
Cmd.Parameters.Add(New SqlParameter("@address1", SqlDbType.VarChar))
Cmd.Parameters(2).Value = txtAddr1.Text
Cmd.Parameters.Add(New SqlParameter("@address2", SqlDbType.VarChar))
Cmd.Parameters(3).Value = txtAddr2.Text
Cmd.Parameters.Add(New SqlParameter("@city", SqlDbType.VarChar))
Cmd.Parameters(4).Value = txtCity.Text
Cmd.Parameters.Add(New SqlParameter("@state", SqlDbType.VarChar))
Cmd.Parameters(5).Value = mnuState.SelectedItem.Value
Cmd.Parameters.Add(New SqlParameter("@zip", SqlDbType.VarChar))
Cmd.Parameters(6).Value = txtZip.Text
Cmd.ExecuteNonQuery()