Question autosearch

clzanas

Member
Joined
Jul 15, 2009
Messages
16
Programming Experience
Beginner
Hi guys,

I am wondering how to do a search from the database sql server record.

Such that when i keyed in a handphone number in the textbox and clicked on the button, it should display that person's name. cuz currently i am now getting the first name only, which is not the case.

for example, i have 8844574, abc in row 0 and item 1 in the database, and 88845221,cba in row 1 and item1 in the database, and if i keyed in 8844574, i should have 8844574, abc displayed on a msgbox.

below is my code so far,

conn.Open()
inc = -1
Dim loginCommand As SqlCommand = conn.CreateCommand()
Dim loginCommand1 As SqlCommand = conn.CreateCommand()
loginCommand.CommandText = "SELECT * FROM ABCcondo WHERE HandPhoneNumber = '" & TextBox1.Text & "'"
Dim dr As SqlDataReader = loginCommand.ExecuteReader

If dr.Read Then
MsgBox(ds.Tables("ABCcondo").Rows(inc).Item(1))
MySoundPlayer.SoundLocation = _
"F:\My documents\TP\sem 6 MPSIP\more to project\mpsip things needed\work from here!!\AUTO INCOMING SMS\Sound Effect - Police Siren 02.wav"
MySoundPlayer.Load()
MySoundPlayer.Play()


End If

MsgBox("Number not in the list")

dr.Close()
conn.Close()

thnks in advance!!
 

Latest posts

Back
Top