July 26, 2005 at 3:05 am
iv got a problem with a query to update a database.
with the following querry i trt to update a table "RecSheet" in database "FuelMaster"
Dim strSQL As String = "USE FuelMaster" & vbCrLf & _
"INSERT INTO RecSheet(RecNr, OrderNr, FleetNr, SiteNr, Operator, CompanyNr)" & vbCrLf & _
"VALUES (" & cRecNr & "," & Order & "," & cFleet & ",'" & cSite & "','" & Operator & "','" & cComp & "')"
then i get this error.
String or binary data would be trunvated. Change database context to 'FuelMaster'.
in the query i do call uppon the 'FuelMaster DB'.
Pleas if anyone knows of this type of error or have a suggestion, pleas let me know
Tnx.
July 26, 2005 at 5:24 am
Dynamic sql is, in general, a very bad idea. It, amoung other things, leaves you very open to certain vulnerabilities, eg sql injection. See http://www.sommarskog.se/dynamic_sql.html for more detail
That said...
The error means that one of the values you are inserting is too large for the column.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply