Query parameters |
Top Previous Next |
There can be parameters in a query text. Let us see the following query:
select * from DVDs where Title = @param1
This is the query to MS SQL demonstration database. The parameter with "param1" name is defined in a query. Here it should be noted: method of describing parameters in a query differs for different DBMS. For MS SQL a parameter is marked by a "@" symbol, MS Access parameters do not have names and are marked by the "?" symbol.
If your SQL query contains parameters, you have to declare them. It can be done in the third step of the "Query Wizard" which we have looked at above. To create a parameter, press the "Add parameter" button. A new parameter will be created:
The following parameter's properties should be set in the properties window:
If you set the parameter properties incorrectly, you will get an error when turning to the last page of the wizard. |