VB.NET: Load data from a MySQL database into a DataGridView control

I want to put the information from my MySQL database to a DataGridView(DataGridView1).

My "MySQL" Columns are

ID, Username & Password

The connection string is

"server=localhost;user id=root;password=;database=exdb"

The table in my database(exdb) is "users" and I have all the necessary connectors, MySQL imports & Re & references in my project.

What should I do?


Yes it's something you can search online and find an asnwer. Give this simple code a try:


//create connection , replace userID/password if you have.
MySqlConnection con = 
  new MySqlConnection(@"server=localhost;user id=root;password=;database=exdb");     
//user the table name as per yours
MySqlDataAdapter adp = new MySqlDataAdapter("Select * from table1;" ,con);

DataSet ds = new DataSet();
//change name according to your datagridview
dataGridView1.DataSource = ds;

Need Your Help

Scala + XML in 2014

xml scala

Now (2014) that the support for XML literals in Scala is officially deprecated, what is the recommended way to work with XML in Scala? My current requirements are XSD support, XML transformations. ...

How to repeat image horizantly in dynamic creation in ios

iphone ios objective-c uiimageview dynamic-image-generation

Could any one help me i want to add same image multiple times horizontally with same height and width. Important thing is i am creating image view dynamically i want to use same image view for all

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.