Bug #7022 Error: Parameter '?' must be defined
Submitted: 5 Dec 2004 17:09 Modified: 7 Dec 2004 16:35
Reporter: Mark White Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:1.0.0-beta OS:Windows (XP .net v1.1)
Assigned to: Reggie Burnett CPU Architecture:Any

[5 Dec 2004 17:09] Mark White
Description:
If I try to insert a field that has a ? in it, I get the error "Message: Parameter '?' must be defined.  Source: MySQL.Data"

How to repeat:
Table td_text has 2 text fields

string sql = "INSERT td_text (name,text) VALUES('data.xml','<?xml version = "1.0" encoding = "UTF-8"?>';
MySql.Data.MySqlClient.MySqlCommand docCommand = new MySql.Data.MySqlClient.MySqlCommand(sql, connDBMySql);
try
{
    docCommand.ExecuteNonQuery();
    retVal = true;
}
[7 Dec 2004 16:35] Reggie Burnett
Thank you for taking the time to report a problem.  Unfortunately
you are not using a current version of the product your reported a
problem with -- the problem might already be fixed. Please download
a new version from http://www.mysql.com/downloads/

If you are able to reproduce the bug with one of the latest versions,
please change the version on this bug report to the version you
tested and change the status back to "Open".  Again, thank you for
your continued support of MySQL.

Additional info:

Mark

This bug was fixed some time ago.  Here is a test case we are currently using to verify it:

		[Test()]
		public void ProblemCharsInSQL()
		{
			execSQL("DROP TABLE IF EXISTS Test");
			execSQL("CREATE TABLE Test (id INT NOT NULL, name VARCHAR(250), PRIMARY KEY(id))");
			execSQL("INSERT INTO test (id, name) VALUES(1, 'This is my;test string–‘’“”…')");
			execSQL("INSERT INTO test (id, name) VALUES(2, 'This string has a ? in it')");

			MySqlCommand cmd = new MySqlCommand("SELECT * FROM Test", conn);
			MySqlDataReader reader = null;
			try 
			{
				reader = cmd.ExecuteReader();
				bool result = reader.Read();
				Assert.AreEqual( true, result );  
				Assert.AreEqual( 1, reader.GetInt32(0));
				Assert.AreEqual( "This is my;test string–‘’“”…", reader.GetString(1));

				Assert.IsTrue ( reader.Read() );
				Assert.AreEqual( 2, reader.GetInt32(0) );
				Assert.AreEqual( "This string has a ? in it", reader.GetString(1) );
			}
			catch (Exception ex) 
			{
				Assert.Fail( ex.Message );
			}
			finally 
			{
				if (reader != null) reader.Close();
			}
		}