Help: DataGridView, DataSet, DataAdapter, CommandBuilder
Posted by: Lou Arnold
Date: August 28, 2006 02:04PM

I can't make the subject items work together. Can someone help?
This is VC++ .Net with V2.0 Framework. The MySqlConnection/Net is at V1.0.7.
The DataGridView and DataSet are .NET V2.0 objects. The rest are from MySqlConnection/Net.

Reading the database with the DataReader works just fine. However, when the CommandBuilder, DataAdapter, DataSet are married up as per the examples, nothing seems to happen. The code is below:
------Code Start
Xda = gcnew MySqlDataAdapter("select * from Source", XConn);
XBlder=gcnew MySqlCommandBuilder(Xda);
Xda->Fill(Xds);
--------
XConn is the connection object; it has been verified as open when the code executes.
Xda is the data adapter; Xds is the DataSet. The DataGridView is connected to the DataSet, and has column names identical to the those of the database. The DataSet has no column or table definitions. XBilder is the CommandBuilder Object.

Supposedly, the code above should at least fill the DataGridView, but the grid stays blank. Supposedly, the DataApater and CommandBuilder should try to determine the schema from the database, and make up Delete, Insert and Update commands, given the Select command. Examining the objects at runtime shows that this doesn't happen.

What is supposed to happen when the Xda->Fill completes? In my program, the Dataset isn't changed, but I would assume it should be rather different after the Fill method.
Some additional code would be appreciated, if its necessary.

Options: ReplyQuote


Subject
Written By
Posted
Help: DataGridView, DataSet, DataAdapter, CommandBuilder
August 28, 2006 02:04PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.