English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

If cboSearch.Text = "Books" Then
Dim ProductId As String
txtProductID.Text = ProductId
ProductId = "SELECT ID, ISBN, Title,Format, Quantity FROM BooksInfo WHERE ISBN ='" & ProductId & "'"
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??

2006-07-25 03:49:20 · 1 answers · asked by braich_gal 3 in Computers & Internet Programming & Design

data is stored in Ms access

2006-07-25 04:26:55 · update #1

set and let statements are not supported anymore

2006-07-27 20:31:54 · update #2

1 answers

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;" & _
"Persist Security Info=False;" & _
"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 ='" & ProductId & "'"
'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

2006-07-25 04:24:10 · answer #1 · answered by samir4381 2 · 0 0

fedest.com, questions and answers