我的数据库中有一个名为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();
}
答案 0 :(得分:1)
将查询字符串调整为
string myQuery1 = "Update AnswerTable SET Points=0";