B
Bill
Got a form that pulls data and allows for the user to enter a
response in a textbox and I have a button that is supposed to push this
reponse text back to the database for that record when clicked. HOWEVER
all that is happening when I do this is the data field that is supposed
to be updated with the text from the textbox goes from being NULL to just
being blank(almost like its updating, but not updating it with the text
in the textbox)
What the heck am I missing here?
Here is my button click code:
Private Sub btnAddResponse_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnAddResponse.Click
Dim cnn As SqlConnection = New SqlConnection( _
"Data Source= CLT-SP2K3;Initial
Catalog=LittleProjectSiteDb;" & _
"UID=ronaldmcdonald;PWD=bigmac")
Dim cmdUpdate As SqlCommand = cnn.CreateCommand()
cmdUpdate.CommandType = CommandType.StoredProcedure
cmdUpdate.CommandText = "addresponse"
cmdUpdate.Parameters.Add(New SqlParameter( _
"@ID", SqlDbType.Int, 9))
cmdUpdate.Parameters("@ID").Value = lblTest.Text
cmdUpdate.Parameters.Add(New SqlParameter( _
"@Response", SqlDbType.Char, 200))
cmdUpdate.Parameters("@Response").Value = txtResponse.Text
Dim da As SqlDataAdapter = New SqlDataAdapter
da.UpdateCommand = cmdUpdate
cnn.Open()
cmdUpdate.ExecuteNonQuery()
End Sub
Here is my stored procedure:
CREATE PROCEDURE addresponse
@ID numeric, @Response char(200)
AS
UPDATE WachoviaRFI SET
RFI_Response=@Response
WHERE
RFI_Number=@ID
GO
response in a textbox and I have a button that is supposed to push this
reponse text back to the database for that record when clicked. HOWEVER
all that is happening when I do this is the data field that is supposed
to be updated with the text from the textbox goes from being NULL to just
being blank(almost like its updating, but not updating it with the text
in the textbox)
What the heck am I missing here?
Here is my button click code:
Private Sub btnAddResponse_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnAddResponse.Click
Dim cnn As SqlConnection = New SqlConnection( _
"Data Source= CLT-SP2K3;Initial
Catalog=LittleProjectSiteDb;" & _
"UID=ronaldmcdonald;PWD=bigmac")
Dim cmdUpdate As SqlCommand = cnn.CreateCommand()
cmdUpdate.CommandType = CommandType.StoredProcedure
cmdUpdate.CommandText = "addresponse"
cmdUpdate.Parameters.Add(New SqlParameter( _
"@ID", SqlDbType.Int, 9))
cmdUpdate.Parameters("@ID").Value = lblTest.Text
cmdUpdate.Parameters.Add(New SqlParameter( _
"@Response", SqlDbType.Char, 200))
cmdUpdate.Parameters("@Response").Value = txtResponse.Text
Dim da As SqlDataAdapter = New SqlDataAdapter
da.UpdateCommand = cmdUpdate
cnn.Open()
cmdUpdate.ExecuteNonQuery()
End Sub
Here is my stored procedure:
CREATE PROCEDURE addresponse
@ID numeric, @Response char(200)
AS
UPDATE WachoviaRFI SET
RFI_Response=@Response
WHERE
RFI_Number=@ID
GO