I am having so much trouble updating this DB. I have the following code
in place and all is working well for the UpdatePerson code, but the
Update Activity fails with no error message, and no update to the DB.
I am trying to re-use the SqlUpdateCommand1 object and I think it is
failing because of that. I can see the UpdatePerson code in profiler,
but the UpdateActivity never seems to make it to SQL.
Can you see what the problem is?
Thanks
Aaron
Public Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Call UpdatePerson()
Call UpdateActivity()
End Sub
Public Sub UpdatePerson()
Dim pID As Integer = Me.GetSelectedPersonID(Me.DataGrid1,
DataSet11, "Searches_Activity")
If pID = 0 Then
Return
End If
Dim SqlUpdateCommand1 As New SqlClient.SqlCommand()
Me.SqlUpdateCommand1.CommandText = "UPDATE Person SET Name_Full =
'" & txtFullname.Text() & "', Title_Long = '" & txtTitle.Text() & "',
Phone = '" & txtphone.Text() & "', CellPhone = '" & txtAppCell.Text() &
"'," & _
"BPhone = '" & txtBPhone.Text() & "', Salary = '" &
txtAppSalary.Text() & "', TotalComp = '" & txtCompensation.Text() & "',
Resume = '" & txtResume.Text() & "', Bphone_Extension = '" &
txtWorkExt.Text() & "', Reg" & _
"ion_CD = '" & txtRegCode.Text() & "'"
Me.SqlUpdateCommand1.CommandText =
Me.SqlUpdateCommand1.CommandText & " where Person_ID = " & pID
SqlDataAdapter1.Update(DataSet11)
End Sub
Public Sub UpdateActivity()
Dim nID As Integer = Me.GetSelectedRecordID(Me.DataGrid1,
DataSet11, "Searches_Activity")
If nID = 0 Then
Return
End If
Dim SqlUpdateCommand1 As New SqlClient.SqlCommand()
Me.SqlUpdateCommand1.CommandText = "UPDATE Activity SET FollowUp
= '" & txtFollowUpDate.Text() & "'"
Me.SqlUpdateCommand1.CommandText =
Me.SqlUpdateCommand1.CommandText & " where Activity_ID = " & nID
Try
SqlDataAdapter1.Update(DataSet11)
Catch ex As Exception
System.Diagnostics.Debug.WriteLine(ex.GetBaseException
().Message())
End Try
End Sub