那些看起来不像是有效的MysqL参数。如果要命名参数,请使用@yournamehere
,如下所示:
MysqLCommand cmd = new MysqLCommand("insert into `screenshots` (`playerId`, `serverId`, `data`, `uploadDate`, `uploadingUserId`) values(@playerId, @serverId, @attachmentData, @dateTime, @userId)", Server.getSingleton().getDbManager().getConnection());
cmd.Parameters.AddWithValue("@playerId", packet.getPlayerId());
您也不应该引用参数。ADO.NET将根据目标列的数据类型根据需要执行此操作。
资料来源:http : //dev.mysql.com/doc/connector-net/en/connector-net- tutorials-parameters.html