SQLSTATE=23000,
[Microsoft] [ODBC SQL Server Driver] [SQL Server] 'id_pk' violation of the PRIMARY KEY constraint, can't duplicate KEY, insertion on the objects' spec '
No changes made to the database.
INSERT INTO the spec (id, spec) VALUES (?,?,?,?,? ,? )
Cb_save: the clicked event
The integer li_ret
Li_ret=dw_1. The Update ()
If li_ret & gt; 0 then
COMMIT;
MessageBox (' tip 'li_ret)
The else
ROLLBACK;
End the if
Cb_add: the clicked event
Long ll_currow
String ls_bh
Ll_currow=dw_1. InsertRow (1)
Dw_1. SetRow (ll_currow)
Dw_1. ScrollToRow (ll_currow)
Dw_1. SetFocus ()
If dw_1. RowCount () & gt; 1 then
Ls_bh=dw_1. GetItemString (2, 'id')
The else
Ls_bh='
End the if
Ls_bh=gs_getbh (ls_bh)
Dw_1. SetItem (ll_currow, "id", ls_bh)
CodePudding user response:
Repeat the primary keyCodePudding user response:
How to solve this problem, seeks the solutionCodePudding user response:
Ls_bhAnd should take the value of the database is it already exists
CodePudding user response:
Take a look at your value function gs_getbh ()CodePudding user response:
Yes, that's function problem, thank youCodePudding user response:
Your data is not the only master key, wei - if not repeat