DuplicateNameException when using wizards and dataset

DuplicateNameException when using wizards and dataset

Postby AnthonyJAttard » Wed 03 May 2006 23:47

Hello, I started to use the trial edition of the MySQL .NET provider and the wizards in VS2003 C# Std.
I used the MySqlConnection object to create the connection - OK
I used the MySqlDataAdapter to access the database and the table, generating the SQL select and update commands - OK
I created the dataset using the data-adapter and I connected it to a datagrid and filled the dataset and the datagrid showed the data from the table - OK
When I ran the program it crashed with a System.Data.DuplicateNameException :cry: on the primary key field.

The sample programs run OK.

Have I used the components properly or is there a certain sequence of steps I should take when using the wizards or is better to just use code?

Regards
AnthonyJAttard
 
Posts: 7
Joined: Wed 03 May 2006 23:37
Location: Melbourne, Australia

Postby Alexey » Thu 04 May 2006 10:57

Please send us small test project if possible to reproduce the problem; it is
desirable to use 'test' schema objects, otherwise include definition of your own database objects. Do not use third party components.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

I found a fix...

Postby AnthonyJAttard » Fri 05 May 2006 09:23

I found that if I created the connection , data adapter and data set using the wizards and added the following code in the Form_Load Event solved my problem.

Code: Select all
private void frmMain_Load(object sender, System.EventArgs e) {
     mySqlConnectionPZC.Open();
     mySqlDataAdapterGames.Fill( dsGames1, "GamesTbl" );
         
}


Where do I send the example project to?
AnthonyJAttard
 
Posts: 7
Joined: Wed 03 May 2006 23:37
Location: Melbourne, Australia

Postby Alexey » Fri 05 May 2006 09:55

Send it to this address: AlexeyI*crlab*com
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for MySQL