954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

retrieve data by VB.Net

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 :-|

DATABASE
Light Poster
32 posts since May 2006
Reputation Points: 10
Solved Threads: 0
 

I have a solution to ur problem. Mail ur problem at [EMAIL="coolamit0072003@hotmail.com"]coolamit0072003@hotmail.com[/EMAIL] and I'll reply with solution.

Amit007
Newbie Poster
22 posts since Aug 2006
Reputation Points: 10
Solved Threads: 0
 

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

Exelio
Junior Poster in Training
57 posts since Aug 2006
Reputation Points: 10
Solved Threads: 0
 

searching data by one character

durgeshmali1987
Newbie Poster
3 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You