【发布时间】:2011-06-18 12:34:35
【问题描述】:
我的代码出现以下异常
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''MachineSimulator''
var sqlParams = new[]
{
new MySqlParameter("@MachineSimulatorDb",GlobalVariables.MachineSimulatorDb),
new MySqlParameter("@CAMXMassagesTable" ,GlobalVariables.CamxmassagesTable)
};
using (var conn = new MySqlConnection(GlobalVariables.ConnectionString))
{
conn.Open();
using(var command = new MySqlCommand())
{
command.Connection = conn;
command.Parameters.AddRange(sqlParams);
command.CommandText = "CREATE DATABASE IF NOT EXISTS @MachineSimulatorDb;";
command.ExecuteNonQuery();
}
}
知道那里出了什么问题吗?
谢谢
【问题讨论】: