MySQL Result into a DataGrid
Hey All,
I have created a .net Windows program using C#. It connects to a mysql server, access the database, query's a table and stores the results in a datagrid. The problem that I'm having with the following code is that in the datagrid, it has the table name as a link then when you click on the link it displays the values from the table.
Here is the code I'm using.
System.Data.OleDb.OleDbDataAdapter adp;
DataSet ds = new DataSet();
// Set connection properties
mysqlConnection = new System.Data.OleDb.OleDbConnection( "Provider=MySQLProv;Data Source=test;User Id=root;Password=;" );
adp = new System.Data.OleDb.OleDbDataAdapter( "Select bam from test", mysqlConnection );
// Open the Connection
mysqlConnection.Open();
// Get the values
adp.Fill( ds, "test" );
// Apply the data
dataGrid1.DataSource = bam;
dataGrid1.Refresh();
// Close the connection
mysqlConnection.Close();
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

weaponzero9 reputationPosted Oct 9, 2003, 5:42 PM EDT
Mahesh ChandRank #1 · 393.3K reputationPosted Oct 10, 2003, 7:21 AM EDT
thed0ct0r84 reputationPosted Oct 14, 2003, 1:30 AM EDT