我想将大字符串值附加到数据库中列值的现有值。此列设置为nvarchar(MAX)
。但是当我尝试时,只有新字符串的前几个部分以旧值附加。其他人不追加。请建议。将值附加到数据库中的列值
string initial_result ="xxxxxx";//reading values from db column and assigning to string
string final_result="yyyyyyyyyy";//lengthier one
SqlCommand cmd71 = new SqlCommand("update details set result='" + initial_result + "'+'"+finalresult+"' where student_id ='11' ", con7);
cmd71.ExecuteNonQuery();
[Use Command Parameters。](http://stackoverflow.com/questions/3216233/what-is-passing-parameters-to-sql-a nd-why-do-i-need-it)这将使代码更好*和*“奇迹般地修复”问题。另外,根据实际操作,可能会跳过'initial_result'中的“阅读”。和往常一样,争取规范化的数据库.. – user2864740 2014-10-17 07:46:03