can anyone tell me what I have going wrong here on this command button?
Code:
Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click
Dim myCmd As SqlCommand
Dim myConn = New SqlConnection("Initial Catalog=NG_DB_Acct_Info;" & _
"Data Source=netgildb.chevron.com;Persist Security Info=True; Integrated Security=SSPI;")
'myCmd = myConn.CreateCommand
'myCmd.CommandText = "SELECT distinct OSversion, Site, DBHost, DBName, DBport, " & _
myCmd.CommandText = "Update NG_DB_Data SET OSVersion = '" & txtOSVersion.Text & "' and Site = '" & txtSite.Text & _
"' and DBHost = '" & txtDBHost.Text & "' and DBAcctID = '" & txtDBAcct.Text & "' and DBAcctPswd '" & txtdbPswd.Text & _
"' and FarmDNS = '" & txtDSNFile.Text & "' WHERE FarmDesc = '" & cmbFarmDesc.SelectedItem & "'"
'SELECT * from NG_DB_Data WHERE (FarmDesc = '" & cmbFarmDesc.SelectedItem & "')"
'Open the connection.
If myConn.state = ConnectionState.Closed Then myConn.open(myCmd.CommandText)
myCmd.ExecuteNonQuery()
MsgBox("Data updated.")
End Sub