Friday, March 16, 2012

Please Help Select Statement Issue

I am trying to use a datagrid to display the data when the user enters a number into a textbox.

Below is my code:

Dim theVal As Integer = cInt(major.text , Integer)

' major is the name of the textbox

SELECT * FROM glmaster WHERE glmaster.major = theVal

When I put a number ie. 1000 where theVal is in the select statement, the datagrid displays the correct data. But as soon as I put a variable there I get an error.

Try "SELECT * FROM glmaster WHERE glmaster.major =" + theVal.ToString

0 comments:

Post a Comment