Solved

vb.net 2008 query Datatable and display result into Datagridview

Posted on 2009-04-14
7
1,256 Views
Last Modified: 2013-11-26
how to query datatable and display result into Datagridview use vb.net 2008 code.
pls provide code.
0
Comment
Question by:aarontham
  • 4
  • 3
7 Comments
 
LVL 9

Expert Comment

by:djon2003
ID: 24139918
Which database will you be using ? MS SQL ?
0
 

Author Comment

by:aarontham
ID: 24140118
hi
i use mysql
0
 
LVL 9

Expert Comment

by:djon2003
ID: 24140195
Oh ok ! Than, you will have to choose which Library you will use to connect to the mysql server. I presume you can do one yourself, but there is free ones around.

I've found an example which provide you a good Library and a really good tutorial on how to do what you need : Connecting VB.NET to a MySQL database.

http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-3
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:aarontham
ID: 24144435
Hi djon2003,

i already connect to mysql and do query. now i need to query datatable and display result into Datagridview

0
 
LVL 9

Expert Comment

by:djon2003
ID: 24144569
Which library do you use to connect to mysql through VB.NET ?

Isn't there a ExecuteQuery or something like method within the MySqlAdapter or MySqlCommand ?
0
 

Author Comment

by:aarontham
ID: 24144612
I use MySqlAdapter.
i already have data in dataset. now i need to quiry dataset and display result into datagridview
0
 
LVL 9

Accepted Solution

by:
djon2003 earned 500 total points
ID: 24146757
A DataSet is usually composed of a property called Tables. If you set the first table (DateSet.Tables(0)) to the DataSource property of your DataGridView, you should see the data within the control.

If your required more personalization about the columns.. You can add those in the DataGridView, but ensure to get all the columns returned by your query. Each column, you have to set the DataPropertyName property which is the ColumnName returned by the query.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now