G
Guest
Hello,
I have code from a Windows form that I am trying to get to work for a Web Form. Does anyone know how I can tweek this so it will work?
Thank you!
Dim strInsert As String
Dim dsInsertRows As DataSet
Dim insertCommand As SqlCommand
If Me.txtLeaseNo.Text <> "" Then
'UPDATE SQL
strInsert = "UPDATE tblLocation SET tblLocation.AddressNo = '" & _
Trim(Me.txtStreetNo.Text) & "', tblLocation.AddressDir = '" & _
Trim(Me.txtStreetDir.Text) & "', tblLocation.AddressName = " & _
Trim(Me.txtStreetName.Text) & " WHERE (((tblLocation.LeaseNo)='" & _
Me.txtLeaseNo.Text & "'))"
insertCommand = New SqlCommand(strInsert)
daLocationEdit.InsertCommand = insertCommand
daLocationEdit.InsertCommand.Connection = conLocationEdit
dsInsertRows = DsLocationEdit.GetChanges(DataRowState.Modified)
'INSERT New Rows
If Not dsInsertRows Is Nothing Then
daLocationEdit.Update(dsInsertRows, "tblLocation")
End If
DsLocationEdit.AcceptChanges()
Else
End If
I have code from a Windows form that I am trying to get to work for a Web Form. Does anyone know how I can tweek this so it will work?
Thank you!
Dim strInsert As String
Dim dsInsertRows As DataSet
Dim insertCommand As SqlCommand
If Me.txtLeaseNo.Text <> "" Then
'UPDATE SQL
strInsert = "UPDATE tblLocation SET tblLocation.AddressNo = '" & _
Trim(Me.txtStreetNo.Text) & "', tblLocation.AddressDir = '" & _
Trim(Me.txtStreetDir.Text) & "', tblLocation.AddressName = " & _
Trim(Me.txtStreetName.Text) & " WHERE (((tblLocation.LeaseNo)='" & _
Me.txtLeaseNo.Text & "'))"
insertCommand = New SqlCommand(strInsert)
daLocationEdit.InsertCommand = insertCommand
daLocationEdit.InsertCommand.Connection = conLocationEdit
dsInsertRows = DsLocationEdit.GetChanges(DataRowState.Modified)
'INSERT New Rows
If Not dsInsertRows Is Nothing Then
daLocationEdit.Update(dsInsertRows, "tblLocation")
End If
DsLocationEdit.AcceptChanges()
Else
End If