0

我的数据库中有一个名为 Points 的列,其中包含数字和 id,希望将此列中的所有记录设置为零。我将如何做到这一点?

这是 iv 到目前为止所做的,

public static void clearPoints()
    {
         OleDbConnection myConnection = GetConnection();
         int count = 0;
        string myQuery1 = "Update AnswerTable  SET Points= " + count+ "'";
        OleDbCommand myCommand = new OleDbCommand(myQuery1, myConnection);

        try
        {
            myConnection.Open();
            myCommand.ExecuteNonQuery();
        }
        catch (Exception ex)
        {
            Console.WriteLine("Exception in DBHandler", ex);
        }
        finally
        {
            myConnection.Close();
        }
4

1 回答 1

1

将您的查询字符串调整为

string myQuery1 = "Update AnswerTable SET Points=0";
于 2013-12-07T13:29:35.523 回答