C#数据库附近语法错误

C#数据库连接总是出这个问题 求大佬解答

从代码来看,应该是C_Sname为空,或者不是正确的字段名造成的 建议修改为: public void UpdateFinalScore(string Sname, string C_Sname) {//修改FinalScore表的成绩 if(string.IsNullOrEmpty(C_Sname)){ return; } SqlConnection conn = new SqlConnection(Properties.Settings.Default.GradeManagementSystemConnectionString); SqlCommand comm = new SqlCommand("update FinalScore set [" + C_Sname + "] = '0' where Sname='" + Sname + "' ", conn);
温馨提示:答案为网友推荐,仅供参考