473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to retrieve multiple records from a access database????????

Hello everyone,
I am making a program at the moment, and need HELP!!!. I'll start
with the database, my field's r:
fldSku - which a 6 digit number, no more no less (145682)
fldDescription - which is the description of a clothing
fldLabel - Which is the band name of the clothing
and fldPrice. k, what i need to do is, when i search for a SKU (which
might have duplicates) in the db, i want it to return it to a datagrid
on the form, and plus i don't know how to retrieve multiple records
from a db, which will be the same SKU, then put them into a datagrid.

Any help is greatly appreciated.
Thanks.

Neil
Ne*************@hotmail.com
Nov 20 '05 #1
1 2459
Hi,

Put a listbox named listbox1 and a datagrid named datagrid1 on a
windows form. Here is a simple example.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim strConn As String
Dim conn As OleDb.OleDbConnection
Dim daCustomer As OleDb.OleDbDataAdapter
Dim ds As DataSet

ds = New DataSet()
strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"
strConn &= "Data Source = Northwind.mdb;"

conn = New OleDb.OleDbConnection(strConn)

daCustomer = New OleDb.OleDbDataAdapter("Select * from Customers",
conn)

ds = New DataSet

daCustomer.Fill(ds, "Customers")

ListBox1.DataSource = ds.Tables("Customers")
ListBox1.DisplayMember = "CustomerID"
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim drv As DataRowView = ListBox1.SelectedValue
Dim stritem As String = drv.Item("CustomerID").ToString
Trace.WriteLine(stritem)

Dim strConn As String
Dim conn As OleDb.OleDbConnection
Dim daOrder As OleDb.OleDbDataAdapter
Dim ds As DataSet

ds = New DataSet
strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"
strConn &= "Data Source = Northwind.mdb;"

conn = New OleDb.OleDbConnection(strConn)

daOrder = New OleDb.OleDbDataAdapter("Select * from Orders where
CustomerID = '" & stritem & "'", conn)
daOrder.Fill(ds, "Orders")
DataGrid1.DataSource = ds.Tables("Orders")
End Sub

Ken
----------------
"Neil" <ne*************@hotmail.com> wrote in message
news:69*************************@posting.google.co m...
Hello everyone,
I am making a program at the moment, and need HELP!!!. I'll start
with the database, my field's r:
fldSku - which a 6 digit number, no more no less (145682)
fldDescription - which is the description of a clothing
fldLabel - Which is the band name of the clothing
and fldPrice. k, what i need to do is, when i search for a SKU (which
might have duplicates) in the db, i want it to return it to a datagrid
on the form, and plus i don't know how to retrieve multiple records
from a db, which will be the same SKU, then put them into a datagrid.

Any help is greatly appreciated.
Thanks.

Neil
Ne*************@hotmail.com

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Daniel Tonks | last post by:
First, please excuse the fact that I'm a complete MySQL newbie. My site used forum software that I wrote myself (in Perl) which, up until now, has used flat files. This worked fine, however...
1
by: Charlie | last post by:
Hello, I have data in an Access table that I would like to export to multiple HTML tables. I would like to split the data in the Access table (about 92,000 records) into multiple HTML...
5
by: Roy Gourgi | last post by:
Hi, I am used to working in Visual FoxPro and I would like to be able to create a database and store and retrieve information from it. What is the simplest way to do it and what should I be...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
12
by: jaYPee | last post by:
I have currently using a dataset to access my data from sql server 2000. The dataset contains 3 tables that is related to each other. parent/child/grandchild relationship. My problem is it's very...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
13
by: kev | last post by:
Hi all, I have created a database for equipments. I have a form to register the equipment meaning filling in all the particulars (ID, serial, type, location etc). I have two buttons at the end...
4
by: LetMeDoIt | last post by:
Greetings, I'm using ASP to retrieve from MSSQL and I then populate a table. After several months of successfull retrieves, this same code now bombs out. It turns out that if I clear out from...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.