Mysql插入错误异常c#

Mysql插入错误异常c#,c#,mysql,database,C#,Mysql,Database,我对插入查询有问题。我不知道有什么问题,因为这个问题看起来不错 表3: id(auto increment int) | idkooilist(int)|toegang(varchar) |naam(tinyint) 代码如下: MySqlConnection myConnection = new MySqlConnection("server = localhost; user id = root; password=testpass;persistsecurityinfo=True;dat

我对插入查询有问题。我不知道有什么问题,因为这个问题看起来不错

表3:

id(auto increment int) | idkooilist(int)|toegang(varchar) |naam(tinyint)
代码如下:

MySqlConnection myConnection = new MySqlConnection("server = localhost; user id = root; password=testpass;persistsecurityinfo=True;database=datanallyspapegaaien");
        myConnection.Open();
        byte boolvalue = new byte();
        if(loc.toegangpubliek==true)
        { boolvalue = 1; }
        else
        {
            boolvalue = 0;
        }

        MySqlCommand myCommand = myConnection.CreateCommand();

        myCommand.CommandText = ("INSERT INTO locatie( idkooilist, toegang, naam) VALUES( @idkooilist @toegang, @naam)");
        myCommand.Parameters.Add("@idkooilist", MySqlDbType.Int64).Value = (idloctokooi);
        myCommand.Parameters.Add("@toegang", MySqlDbType.Byte).Value = boolvalue;
        myCommand.Parameters.Add("@naam", MySqlDbType.VarChar).Value = loc.naam;

        myCommand.ExecuteNonQuery();
以下是错误消息:

MySql.Data.MySqlClient.MySqlException在MySql.Data.dll中发生

附加信息:您的SQL语法有错误;检查 右边是与MySQL服务器版本对应的手册 在第1行的“1,'Bureau')”附近使用的语法


你少了一个逗号

@idkooilist @toegang
添加一个:

@idkooilist, @toegang
所以它看起来像:

"INSERT INTO locatie (idkooilist, toegang, naam) VALUES (@idkooilist, @toegang, @naam)"

问题不是上帝。前两个值之间缺少逗号,toegang(varchar)被称为MySqlDbType.Byte,看起来有点不确定。