Bug #6214 CommandText: Question mark in comment line is being parsed as a parameter
Submitted: 22 Oct 2004 13:40 Modified: 31 Jan 2005 19:46
Reporter: Luke Venediger Email Updates:
Status: Closed Impact on me:
Category:Connector / NET Severity:S3 (Non-critical)
Version:1.0.0 beta OS:Windows (Windows 2003 (.net 1.1))
Assigned to: Reggie Burnett CPU Architecture:Any

[22 Oct 2004 13:40] Luke Venediger
If you have the following line in your query:
  # Is this a comment line?
Then you get the bug:
MySql.Data.MySqlClient.MySqlException: Parameter '?' must be defined

Comment lines in the query text (CommandText) should not be parsed for parameters.

How to repeat:
In your CommandText property, add the lines:
SELECT * FROM tb_SomeTable;
# Is this a comment line?
Run the query

The connector will give you a parse exception, saying the ? parameter must be defined.

Suggested fix:
Avoid parsing comment lines.
[22 Oct 2004 18:27] Reggie Burnett
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

Why would comments like that be supported directly in the SQL?
[23 Oct 2004 12:16] Luke Venediger

I embed query files in my assemblies, as txt files. In the query file sometimes I have comments describing what I'm doing.

[28 Oct 2004 12:33] Reggie Burnett
Ok.  I have reopened the bug and will get this in 1.1
[31 Jan 2005 19:46] Reggie Burnett
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at

Additional info:

This fix will appear in the first 1.1 development release.
[5 Sep 2005 6:14] jeremiah johnson
This is a pretty serious bug for me - any timeline on a release of 1.1?