hi
I have some questions in VB.Net

1- how can I retrieve data by VB.Net from database using MS Access database?
2- can I retrieve data from a database and list them in a CheckedListBox?

thanx

Please help me :-|

hi,

Here is the code to connect to the database in Ms Access.

Connection string for MS Access via OLE DB:

Dim connection As OleDbConnection
connection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\NorthWind.mdb;User Id=;Password=;")

connection.Open();

After connecting to the database

dim da as new oledb.oledbdataadapter("select * from employees",connection)

dim ds as new dataset

da.fill(ds)

Now u can set the datas to the checked listbox.but u can assign only one column to it.

For eg

In checkedlistbox, u have a property items.

for i=0 to ds.tables(0).rows.count-1
Checkbox1.Items.Add(ds.tables(0).rows(i)(0)
next i

This will add all the rows with the first column values

Hope this helps

Regards

Exelio

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.