Bug #27313 Cannot instantiate MySql.Data.MySqlClient.MySqlParameterCollection
Submitted: 21 Mar 2007 0:38 Modified: 21 Mar 2007 13:49
Reporter: Yvan Rodrigues Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:5.0.5 OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any
Tags: Constructor, internal, MySqlParameterCollection, public

[21 Mar 2007 0:38] Yvan Rodrigues
Description:
When compiling a solution that instantiates MySql.Data.MySqlClient.MySqlParameterCollection and is compiling MySql.Data.2005 from source, a compile error like "The type 'MySql.Data.MySqlClient.MySqlParameterCollection' has no constructors defined is present".

How to repeat:
Create a solution e.g. windows forms application
Add the Connector/Net source project from mysql-connector-net-5.0.5-noinstall.
In the main project, instantiate a MySqlParameterCollection e.g.

MySql.Data.MySqlClient.MySqlParameterCollection foo = new MySql.Data.MySqlClient.MySqlParameterCollection()

Compile.

Suggested fix:
In parameter_collection.cs, line 45, change

	internal MySqlParameterCollection()

to

	public MySqlParameterCollection()
[21 Mar 2007 12:24] Reggie Burnett
This is not a bug.  You do not need to instantiate a MySqlParameterCollection since MySqlCommand provides one for you.
[21 Mar 2007 13:49] Yvan Rodrigues
ok, this must have changed in 5.0.3 or 5.0.4

I had built a custom commandbuilder class based on http://www.codeproject.com/cs/database/CustomCommandBuilder.asp that required instantiation.
[10 Jan 2012 1:04] Hugo Vares
You can use:

MySqlParameterCollection mpc = new MySqlCommand().Parameters;