Solved

Update table using multiple datawindows and PFC

Posted on 2004-08-16
1
799 Views
Last Modified: 2013-12-26
Hi all,

The question title says it all;  how do I update one database table using multiple datawindows (pointing to the same table) and PFC?

Here is the situation (simplified):

1 window with the following:
  -  3 command buttons
  -  1 tab control with 2 tab pages
     -  On tabpage 1, there is 1 datawindow.
     -  On tabpage 2, there is a tab control with 5 tabpages.  Each tabpage has 1 datawindow

All the datawindows are pointing to 1 table.  There is a 'New' button that resets & inserts a row into the datawindows, allowing the user to enter a new thing.  

When the user clicks Apply, the program calls the pfc_Save function.  It results in an error (duplicate primary key) when it attempts to update the 1st datawindow on the 2nd tabpage.

I understand why it is giving me the error but need help with the solution.  Why it's giving me the error?  The first datawindow inserts a row into the table successfully.  However, the 2nd datawindow attempts to insert a row using the same primary key.  The 2nd datawindow should perform an update, not an insert.  Please help!

Questions?  Please ask.
0
Comment
Question by:colettim
1 Comment
 
LVL 18

Accepted Solution

by:
diasroshan earned 250 total points
ID: 11817645
hi,

what u need to do is change the status of the rows u need to update to Datamodified! which will create an update statement. The status of all ur dws in ur case is NewModified! and hence creating an insert  statement.

try the following to change the status of ur rows in datawindows other than dw_1.....

dwItemStatus l_status
l_status = dw_rpt.GetItemStatus(1, 0, Primary!)
IF l_status = NewModified! THEN
     dw_rpt.SetItemStatus(1, 0,Primary!, DataModified!)
END IF

do ask if u need more assistance...

Cheers,
Rosh
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VS2008 C++ memory leaks and how to fix them 7 198
eclipse ide not starting 16 82
Doxygen plugin for Android Studio 1 552
eclipse compiler vs Installed JREs option 3 92
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now