Hello...
I have form having a button and a gridview. The gridview is ok and generates data.
But now, i want to populate only the data when i click on the button specified. Can anybody please help me with this ??
Here is my code :
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
Try
'MsgBox("Open")
cn = New OleDbConnection("Provider=microsoft.jet.oledb.4.0;Data Source=E:\Project-Hemtech\HemDatabase1.mdb;")
cn.Open()
cmd = New OleDbCommand("select partname,partdesc,partnum,partqty from partno where type='Mechanical' ", cn)
cmd.ExecuteNonQuery()
MsgBox("Your Account Created Successfully ")
Me.PartnoTableAdapter.Fill(Me.HemDatabase1DataSet1.partno)
Catch myException As Exception
MsgBox("No Record Inserted" + myException.ToString())
Finally
'MsgBox("Closing Connection")
cn.Close()
End Try
But this code gives entire data in the table named partno. I want only those records having type 'Mechanical'. Please help me out as there are 7 such buttons on the form.
Thank You so much !!