hi Alls,

I really need your help regarding this method, Actually i need to create one search box using textbox and the result will display on listbox.

I have textbox1 as inputbox, button1 as search button , listbox1 to display the value , Database1.mdb as my database.

Can u guide me to this?...i really stuck on it....thank you

I'm already thry this code,but the result appear all the name,it not searching by id.....how to do that bro?....pls...

"Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'Create a connection to the database
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Dim Sql As String

cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\Database1.mdb;")
'cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; _Data Source=D:\Database1.mdb;")
'provider to be used when working with access database
cmd = New OleDbCommand("SELECT * from UMP WHERE ", cn)


dr = cmd.ExecuteReader
While dr.Read()

'TextBox1.Text = dr(2)
'TextBox2.Text = dr(1)
'TextBox3.Text = dr(2)
' loading data into TextBoxes by column index
End While

Catch ex As Exception

End Try


End Sub

I don't know enough about the entities in your database to help you here. Your SQL query string, has a "WHERE" clause, with no condition! You need to put someting like:

cmd = New OleDbCommand("SELECT * from UMP WHERE username =" & text1.text, cn)

Thank you bro,

But when i put this,nothing display in listbox,

Actually from my database table i got 3 column that is:-


What i need to do is , when i keep in STAFFID in Textbox then the NAMe and CARDID will display in listbox1.

For this moment all the name was display when i click the button...please help me

Alright, attach your project and database into a zip file, so I can get a first hand look at this thing.

only one field is displaying? if this is the case you need to add another listbox add to the loop

While dr.Read()
End While

Alright, attach your project and database into a zip file, so I can get a first hand look at this thing.

Ok bro, this file that i have attach...plz help me if u got time k...tq

Alhamdulillah, thanks to God, i'm already get the solution...thank all of u... you're very superb......

commented: Finding The Answer Yourself. +10

Very good, you can mark this thread as solved.