SQL server issue
When I try to do an INSERT command and insert text into a field, I get an error.
'The name "XXXX" is not permitted in this context.'
Where XXXX is whatever string I pass in. If I use numbers, however, the INSERT command will work just fine.
All data types are correct (String in VB, varchar in SQL) and I can manually place a text string in a field of the database, it just errors out when I try to do it through code.
Any ideas?
'The name "XXXX" is not permitted in this context.'
Where XXXX is whatever string I pass in. If I use numbers, however, the INSERT command will work just fine.
All data types are correct (String in VB, varchar in SQL) and I can manually place a text string in a field of the database, it just errors out when I try to do it through code.
strSQL = "INSERT INTO tbl72308i (MPS,Model) VALUES (" & strMPS & ", " & strModel & ")" aCommand.CommandText = strSQL Try aCommand.ExecuteNonQuery() Catch ex As Exception MessageBox.Show(ex.Message.ToString) End Try
Any ideas?