syphor

syphor

  • NA
  • 1
  • 0

MySQL Result into a DataGrid

Oct 9 2003 10:16 AM
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();

Answers (3)