Question

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.

Was it helpful?

Solution

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();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top