Tweek Update Command

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top