Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wild card search.. 2

Status
Not open for further replies.
Mar 14, 2002
711
US
This may fall more in to an Oracle posting than ASP.net, but I figured I would ask here first :).

I am trying to create a text box where a user will enter a value, but sometimes this value may be the middle of the actual value in the DB, so I want to set it up so that no matter what they enter, it will search for that key word in all of the DB.

This is the code I have now:

Sub BindData()

NM1.Visible = True

Dim conTab As New OleDbConnection()
conTab = New OleDbConnection("Provider=MSDAORA.1;Password=sdsdsd;User ID=fgfgfgfg;Data Source=DSSOURCE;Persist Security Info=True;")
conTab.Open()


Dim cmdSelect As OleDbCommand

Dim strTitle
strTitle = Title.Text


cmdSelect = New OleDbCommand("Select DOC_NUMBER, DOC_TITLE, REV, STATUS FROM DOC_CO_RECORDS WHERE DOC_TITLE LIKE '" & strTitle & "'", conTab)


Dim DataReader As OleDbDataReader

NM1.DataSource = cmdSelect.ExecuteReader
NM1.DataBind()

conTab.Close()

End Sub


I tried posting the variable like this:

'" % & strTitle & % "' but it did not like that...

Thanks for any input.
 
try changing:
Code:
cmdSelect = New OleDbCommand("Select DOC_NUMBER, DOC_TITLE, REV, STATUS FROM DOC_CO_RECORDS WHERE DOC_TITLE LIKE '" & strTitle & "'", conTab)
to
Code:
cmdSelect = New OleDbCommand("Select DOC_NUMBER, DOC_TITLE, REV, STATUS FROM DOC_CO_RECORDS WHERE DOC_TITLE LIKE '[b]%[/b]" & strTitle & "[b]%[/b]'", conTab)


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
cmdSelect = New OleDbCommand("Select DOC_NUMBER, DOC_TITLE, REV, STATUS FROM DOC_CO_RECORDS WHERE DOC_TITLE LIKE '%" & strTitle & "%'", conTab)

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Genius!! That worked like a charm, I was close, but not close enough with my dabbling...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top