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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LIKE query - using a formatted string in ASP.net web application

Status
Not open for further replies.

jrball

Technical User
Jul 19, 2005
28
US
I have been struggling with this for a while trying to format the strselect string properly to execute the select command on an access database using a asp.net web application. I can't get it formatted the right way to bind the datagrid. Here is what I started with:


condb = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=C:\Inetpub\ strSelect1 = "SELECT MovieId, MovieTitle, MovieCover, MovieIMDB, MovieDate, MovieGenre, MovieRuntime, MovieRating FROM GeneralInfo WHERE (((GeneralInfo.MovieTitle) Like '*' & [the] & '*'));"
cmdSelect1 = New OleDbCommand(strSelect1, condb)
cmdSelect1.Parameters.Add("the", TxtTitle.Text)
condb.Open()
DGMovies.DataSource = cmdSelect1.ExecuteReader()
DGMovies.DataBind()
condb.Close()
 
found it in another forum (not here)

I had to replace the "*" with "%" for it to work in the web app.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top