PDA

Click to See Complete Forum and Search --> : Executing an SQL command


King
Mar 27th, 2000, 08:04 PM
I have an SQL command object in my data environment. The SQL command receives a variable from the user window to extract the required information from the recordset.

How do I call the SQL command, retrieve the user-entered variable, execute it and display the result of the query in my user window in a data grid?

I am utilizing ADO.

dwhawley
Mar 27th, 2000, 08:28 PM
first you need to define a variable to hold the data or paramter that the user will input. we'll call it 'strVariable'. next, insert it into a sql statement along with the name of the table that contains the data. the name of the table will be 'Table'.

"SELECT * FROM Table WHERE '" & strVariable & "'"

important: when i first started struggling with sql statements, i had a real problem with using single quotes and double quotes. make sure you get the syntax right or you will cause yourself a lot of grief. remember that parameter must be surrounded by single quotes.