MySQL Lists are EOL. Please join:

List:MySQL and .NET« Previous MessageNext Message »
From:Leandro Tracchia Date:September 8 2008 4:39pm
Subject:simple DataGridView example???
View as plain text  
hi, first posting here.

i tried my luck on the mysql forums
(http://forums.mysql.com/read.php?47,225648,225648#msg-225648) but
haven't received a reply yet.

i'm basically trying to do the exact same things as described in this
article
(http://dev.mysql.com/tech-resources/articles/Beginning_MYSQL_5_with_Visual_Studio.NET_2005.pdf)
but it is a bit outdated for Visual Studio 2008 because i can't find a
method "SetDataBinding" for the DataGridView component.

i just want to be able to display data from a table on a DataGridView.
here is what my code looks like so far:

MySqlConnection mysqlCon = new MySqlConnection(connString);
mysqlCon.Open();

MySqlDataAdapter MyDA = new MySqlDataAdapter();
string sqlSelectAll = "SELECT * from test";
MyDA.SelectCommand = new MySqlCommand(sqlSelectAll, mysqlCon);

DataTable table = new DataTable();
MyDA.Fill(table);

BindingSource bSource = new BindingSource();
bSource.DataSource = table;

DataGridView dgView = new DataGridView();
dgView.DataSource = bSource;

i can compile all this with NO errors, but for some reason
DataViewGrid shows nothing! just a gray box.

can anyone help?
Thread
simple DataGridView example???Leandro Tracchia8 Sep
  • RE: simple DataGridView example???Chris Robison8 Sep
    • Re: simple DataGridView example???Leandro Tracchia8 Sep
      • Re: simple DataGridView example???Leandro Tracchia8 Sep
        • Re: simple DataGridView example???Leandro Tracchia9 Sep
          • Re: simple DataGridView example???Leandro Tracchia9 Sep