search database

kasey
10-25-2004, 11:16 AM
Hi! I'm trying to search the database using a name field, but having troulbe doing so. I have a textbox where the user can type in the name that they want to search, and then click on a command button cmdSearch, from there, it would display the name that matches in the database in a text box provided. Please advice me on that. Any example code would help. Thanks

Shurik12
10-25-2004, 12:23 PM
Hi,

>Any example code would help.

What about showing what you have so far?

Shurik.

kasey
10-25-2004, 12:40 PM
This is what I have so far but the problem is it displays on a listbox, I like for it to display in a textbox.


Private Sub cmdSearch_Click()
Dim sql As String, rs As ADODB.Recordset
Set rs = New ADODB.Recordset
sql = "Select * from info where name='Example'"
rs.Open sql, db.ConnectionString
List1.Clear
If rs.RecordCount < 0 Then
rs.MoveFirst
Do Until rs.EOF
List1.AddItem rs.Fields("Name").Value
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
End Sub

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum