Поделиться через


How to: Specify Parameter Marker Characters

To mark a name as a parameter and not as a string of literal characters, you place a prefix in front of the parameter name (and, as an option, a suffix after it). For example, parameter marker characters might be "@", ":", or "%". Typically, you use the parameter marker character recognized for your database. For details about what parameter marker characters you need, refer to the documentation for your database or environment.

For example, in your query you might define a parameter called "last name." To indicate that "last name" is a parameter and not a string to search for in the lname column, you might specify that the parameter marker characters are "[" and "]". You can then enter "[last name]" as a search condition value, and the Query and View Designer will correctly interpret "last name" as a parameter.

In rare instances, the parameter marker character you define might also appear in the name of the parameter. If so, you can specify an escape character.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To specify parameter marker characters

  1. From the Tools menu, click Options.

  2. In the Options dialog box expand the Database Tools node and click Query/View Designer.

  3. Enter the parameter prefix character or characters and, if you intend to use one, a suffix character. (You can specify a suffix character only if you have specified a prefix character.) If you need to specify one, enter an escape character.

  4. Enter an escape character.

See Also

Other Resources

Designing Queries and Views

Querying with Parameters