Database Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hum
    New Member
    • Feb 2008
    • 2

    Database Query

    Hi i'm trying to create a code that searches for a word i type in, in a table. kind of like a parameter query but in a visual basic code.

    if i have the following entries in a column called 'ProductName':
    -Poster Paint
    -Poster Paper Rolls
    -Pink Paper

    and i type in the word 'poster' in a textbox, click a command button to search the fields then entries 1 and 2 should be displayed.

    what would be the best way or visual basic code to use?

    another question, is there a way to look at a select query in visual basic code?
  • lotus18
    Contributor
    • Nov 2007
    • 865

    #2
    Originally posted by Hum
    Hi i'm trying to create a code that searches for a word i type in, in a table. kind of like a parameter query but in a visual basic code.

    if i have the following entries in a column called 'ProductName':
    -Poster Paint
    -Poster Paper Rolls
    -Pink Paper

    and i type in the word 'poster' in a textbox, click a command button to search the fields then entries 1 and 2 should be displayed.

    what would be the best way or visual basic code to use?

    another question, is there a way to look at a select query in visual basic code?
    [CODE=vb]rs.Open "Select * From <TableName> Where ProductName Like '%" & Text1.Text & "%'", con,1,1[/CODE]

    Where rs is the recordset, and con is the active connection. BTW, just replace <TableName> with the name of your table.

    Rey Sean

    Comment

    Working...