Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DWC.Update() function - Returns a DW Error Dialog Box - Why?

Status
Not open for further replies.

kaul125

Programmer
Jan 29, 2002
87
US
When I issue a dwc.Update() function and it is not successful, it creates a DW Error Dialog box. I"m not specifically createing this error box. When the update() function fails it creates this box.

Why does it create this box? And more importantly, how do I prevent it from appearing? I want to create my own error checking, but this box keeps on appearing.

I getting the following error in the dialog box:

Violation of PRIMARY KEY constraint 'PK_Colposcopy_chart'. Cannot insert duplicate key in object 'Colposcopy_chart'.

No changes made to database.

INSERT INTO ........

I'm getting this error when the update properties, key modification is set to 'use delete then insert'(PB6.5)

Thnaks in advance!!!

 
Your update is violating primary as it states.
1) Make sure you have the allow update check box checked
2)In 'Where Clause for Update/Delete' use Key Columns
4)Make sure you are specifying the Unique Key Columns as being the Primary Key for that table.


Side Note:
You typically add more flexibility by using an insert/ update stored procedures for processing your records. Allowing you to change some things on the fly when the need arises.
 
I made sure the option you mention were checked on my dw. However, I'm still getting the same error.

I have 1 datawindow that consists of a dddw. Once I select a value from the dddw, another datawindow appears.(This 2nd dw is the one I'm having trouble with). These are the options I've selected for the Update Properties:

Allow Updates - checked
Where Clause for Update/Delete - Key Columns or Key and Updateable Columns
Key Modification - Use Delete then Insert
Unique Key Columns - I selected the primary key

From my understanding, when I issue the dwc.update(), it should delete the row then insert it with the changes I've made. If that is true, why am I getting the 'Insert Error' I've stated in my original post? What should I be performing before the dwc.update()?

Thanks

Keith
 
Is your drop down datawindow editable? or are you using the drop down only for selection in the parent datawindow??
 
The dddw is editable in the sense that when you select a new value in the list and when you click the save button it will save that value along with the corresponding values in the 2nd datawindow.

Does this help?
 
Then you really don't need to set update properties for the datawindow child... you would only need it as a data set for your parent datawindow. If you were attempting to add new values to list to be chosen from then you would need some sort of update process (more than likely a lookup window).

Hope this helps.
 
Hi,

Identifying where to place scripts is half the job of coding. The right event to capture this situation and prevent this dialog is the DBError! event. Return a value of 1 to prevent the default error dialog. Before that, you may like to do your own processing, accessing the situation from the event argument values and maybe flashing your own dialog.

Regards,


Scott
----------------------------------------------------
 
hi,

Can u check what is the columns specific in PK_Colposcopy_chart? I think u already have a record in yr database, and u are trying to insert a same value into it, thats y u hit the message of "Cannot insert duplicate key". The columns that specific in PK_Colposcopy_chart and marked as Unique does not allow to have duplicate record in the database.

Hope i am right and this could help.
 
Hello:
Ever since I defraged my computer this Dw error message keeps creeping up! Does this have anything to do with the defragment of my computer? The message sometimes kicks me off line. "This program has performed and illegal operation and will be shut down" I have the exact error message:
Dw caused an invalid page fault in module Dw.exe at 0167:0043122c the numbers run on and on but that is the jist of my problem :) Any help would be greatly appreciated
Thanks
Kelly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top