If cboSearch.Text = ';Books'; Then
Dim ProductId As String
txtProductID.Text = ProductId
ProductId = ';SELECT ID, ISBN, Title,Format, Quantity FROM BooksInfo WHERE ISBN =''; %26amp; ProductId %26amp; ';'';
Dim dt As New DataTable
OleDbDataAdapter1.Fill(dt)
DataGrid1.DataSource = dt
End If
There's 1 combobox(with the category choices) and 1 textbox...user have to choose the category from the cbobox and type the productid in the txtbox...when i run this code only the info for B0001 is supposed to show on the datagrid, but when i run it..the whole list comes out...how do i solve this??How to solve this search problem??using datagrids and vb.net?
with this new information try this:
dim cn as new adodb.connection
dim rs as new adodb.recordset
set cn = new adodb.connection
set rs = new adodb.reocrdset
cn.Open ';Provider=Microsoft.Jet.OLEDB.4.0;'; %26amp; _
';Persist Security Info=False;'; %26amp; _
';Data Source=C:\database.mdb';
If cboSearch.Text = ';Books'; Then
Dim ProductId As String
txtProductID.Text = ProductId
ProductId = ';SELECT ID, ISBN, Title,Format, Quantity FROM BooksInfo WHERE ISBN =''; %26amp; ProductId %26amp; ';'';
'Dim dt As New DataTable
rs.Open ProductId , cn, adOpenDynamic, adLockOptimistic
'OleDbDataAdapter1.Fill(dt)
DataGrid1.DataSource = rs
End If
rs.close
cn.close
set rs = nothing
set cn = nothing
hope I didn't miss anything
No comments:
Post a Comment