我需要根据用户的需要更新我的SQL Server CE数据库的某一行中的详细信息。但是我收到了错误
解析查询时出错。[令牌行号= 1,令牌行偏移= 31,错误令牌=姓名]
我的查询是:
"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 + "'";"
我做错了什么?
答案 0 :(得分:1)
看起来您的列名称包含空格。
要处理此问题,您需要用方括号[ ]
"Update MembersTable set [First Name]='" + txtFirstName.Text + "',Surname='" + txtSurname.Text + "',[Middle Name]='" // ...