我想將大字符串值附加到數據庫中列值的現有值。此列設置爲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