Syntax error converting the varchar value to a column of data type int.

CookieNZ

Member
Joined
Nov 24, 2005
Messages
17
Programming Experience
Beginner
'Define the connection
Dim dbconnection As New OleDbConnection("provider=sqloledb;server=(local);database=thardata; uid=sa;pwd=tharSQL")

'Define the querystring
Dim dbquerystring As New OleDbDataAdapter("select * from mainjobdetails where jobno=" & Request.QueryString("JobNo"), dbconnection)

'Create a dataset and fill with data
Dim ds As New DataSet()
dbquerystring.Fill(ds,
"joblist")

'Bind the data to the asp
jobinfo.DataSource = ds
jobinfo.Databind()

The jobno in the SQL database is a varchar(32). When I run the page says Syntax error converting the varchar value '10006.01' to a column of data type int.

Who do I convert the querystring?
 
See your other post.... you need to get tick marks (') around the string....

VB.NET:
Dim dbquerystring AsNew OleDbDataAdapter("select * from mainjobdetails where jobno='" & Request.QueryString("JobNo") & "'", dbconnection)

-tg
 
Back
Top