Searching in vb.net

Submitted by saakshi007 on
hi.........i'm new to vb.net i have to make a project where the user enters a s.no in a text box and clicks a button and then the result of search is to be displayed on the data grid............but the problem is that instead of showing only that particular result set it is showing the entire database...........I'm using visual studio 2005 with ms access 2007.........this is the code that i' using
  1. Imports System.Data.OleDb
  2.  
  3. Public Class sno
  4.     Dim ds As DataSet = New DataSet()
  5.     Private Sub sno_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  6.         'TODO: This line of code loads data into the 'RecordDataSet._property' table. You can move, or remove it, as needed.
  7.         Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=C:\Documents and Settings\saakshi.ABC\My Documents\Visual Studio 2005\Projects\record.mdb")
  8.         Dim cmd As OleDbCommand = New OleDbCommand("Select * FROM property", con)
  9.         con.Open()
  10.         Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd)
  11.         Dim myDataSet As DataSet = New DataSet()
  12.         myDA.Fill(myDataSet, "property")
  13.         DataGridView1.DataSource = myDataSet.Tables("property").DefaultView
  14.         con.Close()
  15.         con = Nothing
  16.     End Sub
  17.  
  18.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  19.         Dim con As New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=C:\Documents and Settings\saakshi.ABC\My Documents\Visual Studio 2005\Projects\record.mdb")
  20.         Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM property", con)
  21.         con.Open()
  22.         Dim sdr As OleDbDataReader = cmd.ExecuteReader()
  23.         While sdr.Read = True
  24.             MessageBox.Show(sdr.Item("sno"))
  25.         End While
  26.         sdr.Close()
  27.         con.Close()
  28.         con = Nothing
  29.     End Sub
  30.  
  31. End Class
can someone plz rectify my problem...................