How to search data?

myth faris

New member
Joined
Feb 26, 2008
Messages
1
Location
Pahang,Malaysia
Programming Experience
1-3
i have this code to display search data.. overall this code is success but the image is not been display.. i using MS access and vb.net 2005.. can i know what my coding problem?:confused:


Dim connection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\kaunter6\My Documents\KadKesihatanabaru.mdb;")
'provider to be used when working with access database
Dim [command] As New OleDbCommand("SELECT * FROM KadKesihatanbaru WHERE NoKP LIKE ?", connection)

[command].Parameters.AddWithValue("@NoKP", Me.NoKPMaskedTextBox1.Text & "%")

connection.Open()

Dim dr As OleDb.OleDbDataReader = command.ExecuteReader()

While dr.Read()

NamaLabel4.Text = dr(4)
NamaPremisLabel4.Text = dr(12)
Tarikh_LahirLabel2.Text = dr(6)
JantinaLabel2.Text = dr(8)
BangsaLabel2.Text = dr(9)
GambarPictureBox.image = dr(0)

' loading data into TextBoxes by column index

End While

dr.Close()
connection.Close()
 
Back
Top