Page 1 of 1

DuplicateNameException when using wizards and dataset

Posted: Wed 03 May 2006 23:47
by AnthonyJAttard
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

Posted: Thu 04 May 2006 10:57
by Alexey
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.

I found a fix...

Posted: Fri 05 May 2006 09:23
by AnthonyJAttard
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?

Posted: Fri 05 May 2006 09:55
by Alexey
Send it to this address: AlexeyI*crlab*com