我需要根据用户的需要更新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 + "'";"
我做错了什么??
列名中似乎包含空格。要处理此问题,您需要将列名用方括号[ ]
括起来
"Update MembersTable set [First Name]='" + txtFirstName.Text + "',Surname='" + txtSurname.Text + "',[Middle Name]='" // ...