我試圖通過將SqlDataSource的性質「更新查詢」,寫的代碼,但它顯示錯誤信息來更新我的datagridview的數據修改和更新在數據網格視圖記錄
「主鍵違反約束「PK_contact_master」。不能插入對象「dbo.admission_table」重複鍵。 該語句已終止。「
PLZ告訴我的datagridview編輯數據的準確代碼,並更新它..
謝謝, 丘吉爾
UPDATE:
的SQL代碼:
Update admission_table
set [email protected]_id,
[email protected]_of_degree,
[email protected]_paid,
[email protected],
[email protected]_fees,
[email protected]_of_student,
Dat[email protected]_of_birth,
[email protected],
[email protected],
[email protected]s,
[email protected]_no,
[email protected]_mail,
[email protected]
告訴我們你現在有什麼代碼,也許我們會。 – 2011-03-21 18:50:45
更新admission_table設置registration_id = @ registration_id,name_of_degree = @ name_of_degree,fees_paid = @ fees_paid,hostel = @ hostel,hostel_fees = @ hostel_fees,name_of_student = @ name_of_student,Date_of_birth = @ Date_of_birth,國籍= @國籍,性別= @性別,地址= @地址,電話號碼= @電話號碼,e_mail = @電子郵件,日期= @日期 – Churchill 2011-03-21 18:52:40
registration_id列是我的表的主鍵,等於@registration_id是我的表列的名稱 – Churchill 2011-03-21 18:54:39