i need to search a all related title of the book in my database.. the code below search only exact title..where do i insert an * wildcard to search all related keyword title..ex. if i search computer, all titles that contains keyword computer will be displayed...thanks
Adodc2.Recordset.Filter = "[book]='" & b & "'"

Recommended Answers

All 7 Replies

place wildcard * at the place whre u using the word computer for all computer related book
Adodc2.Recordset.Filter = "[book]='" & b & " * "

Or you can use the %

Adodc2.Recordset.Filter = "[book]='%" & b & "%'"

am student please answer me please
this form use combobox change event use this code
serch data show in datagrid

If cmbsd.Text = "1" Then
q = "select *from student where std=" & cmbsd.Text & " AND admin=" & year.Text & " "
r.CursorLocation = adUseClient

r.Open q, cn, adOpenDynamic, adLockPessimistic

set datagrid2.datasource=r
End If

error: data type mismatch criteria expression

"error: data type mismatch criteria expression "
this can be due to
u've defined ur constraint in one data type & providing input in another data type

Tarang, please open a new thread for your question. This thread belongs to JunJun as above. Further, your select statement is incorrect -

q = "select *from student where std=" & cmbsd.Text & " AND admin=" & year.Text & " "

should read -

q = "SELECT * FROM student WHERE std=" & "'" & cmbsd.Text & "'" & " AND admin=" & "'" & year.Text & "'", cnMyDatabase, adLockOptimistic, adOpenStatic

If you get more errors, please post a new thread with the error and we will gladly help.

q = "SELECT * FROM student WHERE std=" & "'" & cmbsd.Text & "'" & " AND admin=" & "'" & year.Text & "'", cnMyDatabase, adLockOptimistic, adOpenStatic
this code reply me AndreRet and i am use this code succesful run

but second time i will run this code error will be introduce
data type mismatch criteria expression

Tarang! As above, please open your own thread. This one belongs to JunJun. The reason you are getting the error is because the first time you run the code, your q will open the recordset, but the second time it reaches end of file. Refresh all search criteria and THEN open it again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.