I am trying to search data in database at runtime....
when a user put the license no in the text box and press button

this is my query but it is not working, for every search it is showing first record of the database......

Set rd = New Recordset
rd.Open "select * from LEARNER where 'LICENSE_NO=(Text1.Text)'", db, adOpenStatic, adLockOptimistic

your close but a few things wrong with your string concatination...

"SELECT * FROM LERNER WHERE LICENSE_NO='" & Text1.Text & "'", db,...

Good Luck

your close but a few things wrong with your string concatination...

"SELECT * FROM LERNER WHERE LICENSE_NO='" & Text1.Text & "'", db,...

Good Luck

Thanks

Hey, pls considered this two sql statement

'use this if LICENSE_NO Field is text type

"SELECT * FROM LERNER WHERE LICENSE_NO='" & Text1.Text & "'", db,...

'use this if LICENSE_NO Field is integer or autonumber

"SELECT * FROM LERNER WHERE LICENSE_NO=" & Text1.Text

you may also visit this site for your reference.

http://visualbasic-source-code.com/tag/sql-statement

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.