A
Aaron
I am having some problems updating an SQL view with a button click.
Could someone point me in the right direction?
This code runs without any errors, but the sql command never makes it the
the SQL server.
I'm not using a parameters collection or anything, basically because I am
not sure how to map textboxes to SQL Parameters. If there is a better
approach, please let me know...
Thanks,
Aaron
Public Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
'Dim sqlUpdateCommand1 As New SqlClient.SqlCommand()
Dim con
con = Me.SqlConnection1.ConnectionString
Dim nID As Integer = Me.GetSelectedRecordID(Me.DataGrid1,
DataSet11, "Searches_Activity")
If nID = 0 Then
Return
End If
Me.SqlUpdateCommand1.CommandText = "UPDATE Searches_Activity SET
Activity_Activity_CD = '" & txtACD.Text() & "', Activity_Result_CD = '" &
txtRCD.Text() & "', Activi" & _
"ty_Date = '" & txtActDate.Text() & "', Activity_FollowUp = '" &
txtFollowUpDate.Text() & "', Activity_Notes = '" & txtNotes.Text() & "',
Activity_Notes_Confidential = '" & txtConfNotes.Text() & "'," & _
" App_Name_Full = '" & txtFullname.Text() & "', App_Title_Long = '" &
txtTitle.Text() & "', App_Company = '" & txtCompany.Text() & "',
App_Phone = '" & txtphone.Text() & "', App_Cell = '" & txtAppCell.Text()
& "', App_" & _
"BPhone = '" & txtBPhone.Text() & "', App_Salary = '" & txtAppSalary.Text
() & "', App_TotalComp = '" & txtCompensation.Text() & "', App_Resume =
'" & txtResume.Text() & "', App_Bphone_Ext = '" & txtWorkExt.Text() & "',
App_Reg" & _
"ion_CD = '" & txtRegCode.Text() & "' where activity_ID = "
Me.SqlUpdateCommand1.CommandText =
Me.SqlUpdateCommand1.CommandText & nID
Dim UpdateSQL
UpdateSQL = Me.SqlUpdateCommand1.CommandText
'SqlDataAdapter1.Update(DataSet11, "Table")
SqlDataAdapter1.Update(DataSet11)
End Sub
Could someone point me in the right direction?
This code runs without any errors, but the sql command never makes it the
the SQL server.
I'm not using a parameters collection or anything, basically because I am
not sure how to map textboxes to SQL Parameters. If there is a better
approach, please let me know...
Thanks,
Aaron
Public Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
'Dim sqlUpdateCommand1 As New SqlClient.SqlCommand()
Dim con
con = Me.SqlConnection1.ConnectionString
Dim nID As Integer = Me.GetSelectedRecordID(Me.DataGrid1,
DataSet11, "Searches_Activity")
If nID = 0 Then
Return
End If
Me.SqlUpdateCommand1.CommandText = "UPDATE Searches_Activity SET
Activity_Activity_CD = '" & txtACD.Text() & "', Activity_Result_CD = '" &
txtRCD.Text() & "', Activi" & _
"ty_Date = '" & txtActDate.Text() & "', Activity_FollowUp = '" &
txtFollowUpDate.Text() & "', Activity_Notes = '" & txtNotes.Text() & "',
Activity_Notes_Confidential = '" & txtConfNotes.Text() & "'," & _
" App_Name_Full = '" & txtFullname.Text() & "', App_Title_Long = '" &
txtTitle.Text() & "', App_Company = '" & txtCompany.Text() & "',
App_Phone = '" & txtphone.Text() & "', App_Cell = '" & txtAppCell.Text()
& "', App_" & _
"BPhone = '" & txtBPhone.Text() & "', App_Salary = '" & txtAppSalary.Text
() & "', App_TotalComp = '" & txtCompensation.Text() & "', App_Resume =
'" & txtResume.Text() & "', App_Bphone_Ext = '" & txtWorkExt.Text() & "',
App_Reg" & _
"ion_CD = '" & txtRegCode.Text() & "' where activity_ID = "
Me.SqlUpdateCommand1.CommandText =
Me.SqlUpdateCommand1.CommandText & nID
Dim UpdateSQL
UpdateSQL = Me.SqlUpdateCommand1.CommandText
'SqlDataAdapter1.Update(DataSet11, "Table")
SqlDataAdapter1.Update(DataSet11)
End Sub