Discord.NET 踢球命令

Discord.NET Kick Command

所以我有一个正在为计算机科学项目工作的机器人,但我的踢球命令不起作用。我已经尝试注释掉更新 SQL 和 ReplyAsync 行,但它不会踢用户。我是否为用户使用了错误的数据类型?

public class Kick : ModuleBase<SocketCommandContext>
    {
        OleDbConnection con;
        OleDbDataAdapter da;

        [Command("kick")]
        [RequireUserPermission(GuildPermission.KickMembers)]
        [RequireBotPermission(GuildPermission.KickMembers)]
        public async Task KickUser(IGuildUser user, string reason = "No reason provided")
        {
            con = new OleDbConnection();
            con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=BotDB.accdb";
            da = new OleDbDataAdapter();

            con.Open();
            da.InsertCommand = new OleDbCommand($"UPDATE UserData SET NumKick = NumKick + 1 WHERE UserID = '{Convert.ToString(user.Id)}'");
            da.InsertCommand.ExecuteNonQuery();
            con.Close();

            await ReplyAsync($"{user.Nickname} was kicked from the server for '{reason}'");
            await user.KickAsync(reason);
        }
    }

我设法修复了它,由于字符串原因我不得不删除默认值,并且在 InsertCommand 区域我忘记在 SQL.

之后声明 OleDbConnection