?
Solved

vb.net 2008 query Datatable and display result into Datagridview

Posted on 2009-04-14
7
Medium Priority
?
1,291 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
[X]
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
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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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 (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

762 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