Solved 2008 query Datatable and display result into Datagridview

Posted on 2009-04-14
Last Modified: 2013-11-26
how to query datatable and display result into Datagridview use 2008 code.
pls provide code.
Question by:aarontham
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3

Expert Comment

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

Author Comment

ID: 24140118
i use mysql

Expert Comment

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.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 24144435
Hi djon2003,

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


Expert Comment

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 ?

Author Comment

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

Accepted Solution

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.

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor ( Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

726 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