I have a piece of code that takes two strings, puts them together, then attempts to save that result into a table in a database. For some reason, the database is only showing the second half of the string ( Me.txtRev.text
in this case). When in debug, I can see that newRev
is actually correct, with the hyphenated string.
Any ideas anyone? Thanks in advance!
Dim newRev As String = Me.revs(0) & "-" & Me.txtRev.Text
Try
Dim sqlSOPDept As New SqlClient.SqlCommand
Dim sqlConn As New SqlClient.SqlConnection("Data Source=IMS-SQL-01;Initial Catalog=ImageTraining;Integrated Security=True")
sqlSOPDept.CommandText = "UPDATE dbo.docHeader SET revision =" & newRev & " WHERE model = '" & Me.cmbModel.SelectedValue.ToString & "' AND part = '" & Me.cmbPart.SelectedValue.ToString & "'"
sqlSOPDept.CommandType = CommandType.Text
sqlSOPDept.Connection = sqlConn
sqlConn.Open()
sqlSOPDept.ExecuteNonQuery()
sqlConn.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try