Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Andy Kramek
  Where is Andy Kramek?
 Westminster Circle, Akron
 Ohio - United States
 Andy Kramek
 To: mk sharma
  Where is mk sharma?
 mumbai
 India
 mk sharma
 Tags
Subject: RE: andykr class"updres" to handle conflict
Thread ID: 210886 Message ID: 211269 # Views: 47 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Sunday, January 11, 2009 3:11:42 PM         
   


> i am using a class designed by andykr "updres"
>
> this class works very well with a single table but not working proper with more than one table like
>
>
> llok = tableupdate(.t.,.f.,"inward1") and tableupdate(.t.,.f.,"inward")
> 

>
> if a real conflict than i want to take same step for both the tables
>
> Force my changes OR Undo my Change for both the table.
>
> in my save command button
>
> do updbuffer2 with "inward1",thisform.datasessionid,"inward"
>
> but this class works with one alias
>
> attachment is "updres" class
> http://www.foxite.com/uploads/d54eebe9-4fbf-4503-b3ce-079f951ca1a7.rar
>
> below is my "updbuffer2.prg"
>
>
> procedure updbuffer2
> ****
> parameters updbufferalias, updbufferdatasessionid, updbufferalias1
> *Parameters updbufferalias, updbufferdatasessionid
> local llOk, llOk1, oUpd, laErr[1]
> *** Select the main table
> select &updbufferalias && child table
> *** Try and update
> *** If update fails, create the conflict resolution object
> if not empty(updbufferalias1)
>    llOk = tableupdate(.t.,.f.,(updbufferalias)) and tableupdate(.t.,.f.,(updbufferalias1))
> else
>    llOk = tableupdate(.t.,.f.,(updbufferalias))
> endif
> if ! llOk
>    aerror( laErr )
>    if laErr[1] = 1585
>       oUpd = createobject('updres', updbufferdatasessionid, alias())
>       if type( 'oUpd' ) = "O" and ! isnull( oUpd )
>          oUpd.show()
>       endif
>    else
> *** What other error could we get here?
>       messagebox( message(), 16, "Whoops!" )
>    endif
> endif
> *ENDIF
> *** Refresh the for
> 

>
> warm regards,
> mk.

I am sorry, this class is not designed to handle multiple table updates and I have neither the time, nor any interest, in modifying it to handle that scenario because that is NOT good practice. If you need multiple table updates, use a transaction and handle the updates separately and handle conflicts separately.

You have the source code, if you can't make it do what you want why are you asking me to?

Regards
Andy Kramek
Microsoft MVP (Visual FoxPro)
Tightline Computers Inc, Akron Ohio, USA



COMPLETE THREAD
andykr class"updres" to handle conflict Posted by mk sharma @ 1/8/2009 10:46:59 AM
RE: andykr class"updres" to handle conflict Posted by mk sharma @ 1/10/2009 3:01:36 PM
RE: andykr class"updres" to handle conflict Posted by Andy Kramek @ 1/11/2009 3:11:42 PM