解析从 C# 程序到 SQL 服务器 CE 的查询时出错

Error parsing query from C# program to SQL Server CE

我需要根据用户的需要更新 SQL Server CE 数据库中特定行的详细信息。但是我得到一个错误

There was an error parsing the query.[Token line number=1,Token line offset=31,Token in error=Name]

我的查询是:

"Update MembersTable set First Name='" + txtFirstName.Text +
    "', Surname='" + txtSurname.Text + 
    "', Middle Name='" + txtMiddleName.Text +
    "',Home Address='" + txtAddress.Text +
    "',Date Of Birth='" + dtpDOB.Text + 
    "',Home Phone No='" + txtHomePhone.Text +
    "',Mobile No='" + txtMobilePhone.Text + 
    "',Email='" + txtEmail.Text +
    "',Profession='" + txtProfession.Text + 
    "',Cell Leaders Name='" + txtCellLeader.Text +
    "' Where ID='" + DC.ID + "'";"

我做错了什么??

您的列名似乎包含空格。 为了解决这个问题,您需要用方括号 [ ]

将列名括起来
"Update MembersTable set [First Name]='" + txtFirstName.Text + "',Surname='" + txtSurname.Text + "',[Middle Name]='" // ...