Thursday, March 29, 2012

correct syntax for ADO.net recordsets Select method.

I have a interger stored in x.

I want to use x in a SELECT statement like so :

SELECT * from aTable WHERE A_Column = x

This select statement is then assigned to and passed as a string like :

sql = "SELECT * from aTable WHERE A_Column = x"

How does the x get interpreted correctly ?Try:

sql = "SELECT * from aTable WHERE A_Column = " & x

No comments:

Post a Comment