每当我试图运行我的程序时,这个错误就会发生。
附加信息:您的SQL语法有错误;请检查与您的MySQL服务器版本对应的手册,以便在第1行使用正确的语法
守则如下:
private void create_Click(object sender, EventArgs e)
{
string MyConnectionString = "Server=x.x.x.x;Database=groupdes_New;Uid=root;Pwd=password;";
//create connection
MySqlConnection connection = new MySqlConnection(MyConnectionString);
//connect to database
connection.Open();
MySqlCommand cmd;
cmd = connection.CreateCommand();//create command
cmd.CommandText = "CREATE Table Newtable (" + "name" + ")";
cmd.ExecuteNonQuery();
if (connection.State == ConnectionState.Open)
{
connection.Close();
}
}我还是解决不了这个错误。谢谢你的帮助!
发布于 2016-05-13 14:50:27
你的创造表是错误的。
您需要定义字段数据类型。
CREATE TABLE Table1
(`myDate` datetime)
;https://stackoverflow.com/questions/37213039
复制相似问题