create a TableAdapter method with parameters when using OLEDB

October 2, 2009


If use the following query script for creating a TableAdapter method, like “GetDataById”, when using OLEDB:

“SELECT * FROM aTable WHERE theID=@id”

an error will happen:

“error in where clause near ‘@’ unable to parse query text”

The solution is to use “?”, instead of “@variablename”, so teh following will succeed:

“SELECT * FROM aTable WHERE theID=?”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.