Ok, well I had this same question open just the other day, and I was able with help from people on here to get my update to work, but my insert isn't working now. Below is the code. No errors, just doesn't insert anything into my TL_Events but it does update TL_Tooling.
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
'\\\\\\\\\\\\\\\\\SQL CONNECTION TO INSERT TO TL_EVENTS\\\\\\\\\\
'build sql connection string at run time
Dim connect As SqlConnection = New SqlConnection()
connect.ConnectionString = "Data Source=(local);" & _
"Initial Catalog=Triumph;" & _
"Integrated Security=SSPI"
'Opens the SQL Connection
connect.Open()
Dim strSQLInsert As String
strSQLInsert = "Insert into TL_EVENTS(EventType,Company,EntryDate,EntryPerson,ToolID,Comments) values ("
strSQLInsert = strSQLInsert & "'" & Trim(txtRedTag.Text) & "',"
strSQLInsert = strSQLInsert & "'" & Trim(txtCompany.Text) & "',"
strSQLInsert = strSQLInsert & "'" & Trim(txtEntryDate.Text) & "',"
strSQLInsert = strSQLInsert & "'" & Trim(txtSupervisor.Text) & "',"
strSQLInsert = strSQLInsert & "'" & Trim(txtToolID.Text) & "',"
strSQLInsert = strSQLInsert & "'" & Trim(txtDamageDescription.Text) & "')"
strSQLInsert = "Update TL_Tooling "
strSQLInsert = strSQLInsert & " SET StatusCode = '" & Trim(txtRedTag.Text) & "',"
strSQLInsert = strSQLInsert & " Company = '" & Trim(txtCompany.Text) & "'"
strSQLInsert = strSQLInsert & " WHERE ToolID = '" & Trim(txtToolID.Text) & "'"
'open command object(takes two parameters sqlstring, connection)
Dim command As New SqlCommand(strSQLInsert, connect)
Try
'execute command object
command.ExecuteNonQuery()
Catch ae As SqlException
MessageBox.Show(ae.Message)
Finally
'clean up code
command.Dispose()
connect.Close()
connect = Nothing
End Try