Im doing a project on cyber cafe managment which needs search and it should search for name ,phone,date ....Theirs a constrain that if the names of the users are same then it has to give me all the users with the name :)
can anyone help me out for creating a searching table
Collapse
X
-
this is the code which i used...to search for a single attribute but i want the fields which are repeated to be shown along wit it
Code:Dim rs As New ADODB.Recordset Dim cn As New ADODB.Connection Private Sub cmdsearch_Click() If txtsearch = "" Then MsgBox "invalid search keyword", vbCritical, "book" Exit Sub End If cn.Open rs.Open "select * from s5 where name='" & txtsearch & "' or phone='" & txtsearch & "' or d1='" & txtsearch & "'", cn, adOpenDynamic, adLockOptimistic If rs.EOF And rs.BOF Then MsgBox "item doesnot exist", vbCritical, "book" Else lblsearch.Caption = "Name:" + rs!Name + vbNewLine + "Phone Number:" + rs!phone + vbNewLine + "Date:" + rs!d1 End If rs.Close cn.Close End Sub Private Sub Form_Load() Set cn = New ADODB.Connection Set rs = New ADODB.Recordset cn.ConnectionString = "Provider=MSDAORA.1;Password=tiger;User ID=system;Persist Security Info=True" End Sub
Last edited by Rabbit; Oct 22 '13, 03:56 PM. Reason: Please use [CODE] and [/CODE] tags when posting code or formatted data. -
Use sql query to do
Sample:
Code:strSql = "Select * from TableName Where searchField1 like '" & strSearchString & "%' or searchField2 like '" & strSearchString & "%'"
Comment
Comment