Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 22, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Create Queries On the Fly

Use VB's string-concatentation operator (&) to incorporate user input into SQL queries at run time. Assume, for example, that cboField is a combo box containing a list of fields in a table, and txtValue is a text box into which the user types a value to search for. Here's how to create a dynamic query that includes the user's input:
sField = cboField
sValue = txtValue
SQL = "SELECT * FROM Table WHERE " & _
	sField & " LIKE '" & sValue & "';"
Note that you must surround the search value with quotes if you are searching a text field; no quotes are necessary if the target field contains numeric data./p>
Claudia Vega
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date