Data binding in Visual Studio Express

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
nextstep
Posts: 3
Joined: Tue 25 Sep 2007 19:26

Data binding in Visual Studio Express

Post by nextstep » Tue 25 Sep 2007 23:01

I've tried to bind a mySqlDataAdapter to a data grid view, but without much success (in C# Visual Studio Express 2005).

The following is working:

- mySqlConnection
- mySqlCommand (data is returned when one clicks on Execute )

But the DataAdapter Fill and Preview fails (although I can bind the specific table to the data grid view in the designer, but no data is being displayed when I run the application):

- Fill -> SelectCommand property not initialized before calling Fill

- Preview -> Unable to cast COMObject of type System.__ComObject ... No such Interface supported ...

Is there any order in which the Core Lab objects should be loaded?

The following has been added:

- MySQLConnector
- MySQLDataAdapter
- MySQLDataSet
- GridView with Binding Source

Any help or pointers will be appreciated (I also need to bind data to a form with text fields, but that's another story) ...

nextstep
Posts: 3
Joined: Tue 25 Sep 2007 19:26

Post by nextstep » Tue 25 Sep 2007 23:10

Let me rephrase the question somewhat ...

When trying to bind a DataAdapter to a gridView, should one add any additional code, or will the adding of Core Lab objects handle that automatically?

And how would one bind data to a form with text fields (I'm specifically referring to C# with the Core Lab MyDirect product)?

thanks!

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Wed 26 Sep 2007 09:18

When trying to bind a DataAdapter to a gridView, should one add any additional code, or will the adding of Core Lab objects handle that automatically?
Use the following code:

Code: Select all

            mySqlDataAdapter1.Fill(dataSet1);
            dataGridView1.DataSource = dataSet1;
            dataGridView1.DataMember = "table name>";
And how would one bind data to a form with text fields (I'm specifically referring to C# with the Core Lab MyDirect product)?
For these purposes I suggest you using our MySqlDataTable component.

nextstep
Posts: 3
Joined: Tue 25 Sep 2007 19:26

Post by nextstep » Wed 26 Sep 2007 09:26

Thanks for the reply, so one should add a little bit of code to make all of this work.

As per my e-mail, could the usage of Connector/NET (from mySQL) be part of the grid view load up (and preview) problem?

I've used that when I started with the project, and it is still connecting to the database upon load up. Would that cause a conflict with myDirect?

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Wed 26 Sep 2007 11:51

could the usage of Connector/NET (from mySQL) be part of the grid view load up (and preview) problem?
It is unlikely. Try to create a fresh project to check this out.

Post Reply