Hello ,
I had made a databse application , in one of my form , i had two search criteria , one search by partyname , which will fetch a data from demo table : the code is
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ds.Clear()
Da = New OleDb.OleDbDataAdapter("Select * from demo where PartyName = '" + txtspartyname.Text + "'", Cnn)
Da.Fill(ds, "demo")
DataGridView1.DataSource = ds.Tables(0)
End Sub
the othere criteria is to search by customername , wgich will fetch the data from "sales" table : The Code
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
ds.Clear()
Da = New OleDb.OleDbDataAdapter("Select * from sales where CustomerName = '" + TextBox6.Text + "'", Cnn)
Da.Fill(ds, "sales")
DataGridView1.DataSource = ds.Tables(0)
End Sub
Both Button work fine,
The problem is that if i search by "partyname" , the result is display in grid view , but when i go to search by "customername" , the previous "demotable" is still there in datagridview , so my search criteria doesn't give me any result , same case if i go for search by "CustomerName" , the result are display but when i go to search by "Partyname " the prvious "Sales table " is still present . ..Hope u got wht me trying to . Plz Help me out...