Record Search

sistronia

New member
Joined
Feb 2, 2008
Messages
2
Programming Experience
Beginner
Hello there
I created new project using vb.Net and ms Access 2002 as database , please help me with search method , if i want to search for a record in the db , using the vb.net application , how to do it , what is the code .
thank you
 
iam just a novice but i think this would be helpful:

first try to study about SQL commands particularly the SELECT - WHERE statement ( this is the key to your problem ) then try to embed it on your oledbadaptername.selectcommand or simply copy this code

Dim searchvalue As String
Connect()
searchvalue = InputBox("Enter StudentNumber", "Search")
If searchvalue <> "" Then
DS.Tables("StudentInformation").DefaultView.Sort = "StudentNumber"
Dim RowIndex As Integer = DS.Tables("StudentInformation").DefaultView.Find(searchvalue)
If RowIndex = -1 Then
MessageBox.Show("No match found", "search", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
CM.Position = RowIndex
End If
End If
 
Back
Top