views:

266

answers:

1

According to the MySQL .Net connector docs, when running prepared statements, the @ symbol is used to defined a paramter. When trying this I got an error. Then the user comment at the bottom of the page says if you have problems, substitute the ? for the @ character. Is there any way to control what character MySQL expects for prepared statements? I would prefer that it used to the "@" symbol as it would make it more similar to SQL Server, which I'm trying to migrate from.

+1  A: 

Old Syntax, OldSyntax: Allows use of '@' symbol as a parameter marker. This option was deprecated in Connector/NET 5.2.2. All future code should be written using the '@' symbol.

MySqlConnection myConnection = new MySqlConnection();
myConnection.ConnectionString = "**OldSyntax=true**; server=myHost; database=myDB; Username=myUser; pwd=myPass; ";
myConnection.Open();
ax
Thanks for the info. Perhaps an error in the MySQL Documentation, that second "@" symbol should probably be "?".
Kibbee
according to http://bugs.mysql.com/bug.php?id=37349, "starting with 5.2 you should be using '@' but '?' will still work". also: "'@' is *again* the recommended identifier" ...).which version are you using? 5.2.x?
ax
I'm using 5.2.5. Just downloaded it a week ago. I'm confused though, what's the proper syntax supposed to be now?
Kibbee