Hello Everyone & please excuse my ignorance. I am fairley new to .net and newer to SQL. The below code gives me an exception telling me that it is an invalid column name. It's taking the input string from "frmMain.txtBad ge.Text" and thinking it's the column name. I have searched for days without any clue. Any help would be appreciated.
Thanks
Thanks
Code:
Sub chkGunIn()
Dim daGun As New SqlDataAdapter
Dim dsGun As New System.Data.DataSet
Dim searchGunIn As String
searchGunIn = DateTime.Now
Dim mySelectQuery As String = ("UPDATE RF_Assign SET Gun_In = '" _
& searchGunIn & "' ,Batt_In = '" & searchGunIn _
& "' WHERE Badge = " & frmMain.txtBadge.Text)
Dim myConnection As New SqlConnection(connectionString)
Dim myCommand As New SqlCommand(mySelectQuery, myConnection)
Try
myConnection.Open()
daGun.SelectCommand = myCommand
daGun.Fill(dsGun)
myCommand.ExecuteNonQuery()
myConnection.Close()
cmdClearTXT()
myConnection.Close()
Catch ex As System.Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Comment