Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Nivedita Joshi
  Where is Nivedita Joshi?
 pune
 India
 Nivedita Joshi
 To: tushar Kanvinde
  Where is tushar Kanvinde?
 Kolhapur, Maharastra
 India
 tushar Kanvinde
 Tags
Subject: RE: when & where to use flush command?
Thread ID: 269046 Message ID: 269073 # Views: 35 # Ratings: 0
Version: Visual FoxPro 6 Category: Projects and Design
Date: Friday, July 16, 2010 10:20:45 AM         
   


> > Hello Experts,
> >
> > I am having a code where while saving i locks a record with lock()function & after saving unlocks it. I am also having Begin transaction & end transaction command in this code, now i want to use flush command into this so when & where i have to use this command & what's advantages of using flush command? I read foxpro help file but can't understand the description.
> > i am giving a sample code below :
> >
> >
> > BEGIN TRANSACTION
> > Select (Base_fl)
> > Seek dtos(m.ddoc_date)+m.cdoc_no
> > If found()
> > 	LOCK()
> > 	If Closeac='Y'
> > 	Replace namount   with m.namount
> > 	Endif
> > 	Unlock
> > 	Select Tran
> > 	Seek dtos(m.ddoc_Date)+m.cdoc_no
> > 	If Found()
> > 		LOCK()
> > 		Replace namount   with m.namount
> > 		Unlock
> > 	Endif
> > Else
> > 	Rollback
> > 	Select (PassAlias)
> > 	This.Enabled=.t.
> > 	Return
> > Endif
> > Select Acctmast
> > Seek M.cgl_code+M.csl_code
> > If Found()
> > 	LOCK()
> > 	If Closeac='Y'
> > 		Replace Cac_status With 'C'
> > 	Endif
> > 	If Rptoddate='Y'
> > 	    Replace dtod_due_date with m.ddoc_date
> > 	Endif
> > 	If Rptodamt='Y'
> > 		If Afterbal<0
> > 		Replace ntod_limit with abs(afterpassbal)
> > 		Else
> > 		Replace ntod_limit with abs(afterpassbal)
> > 		Endif
> > 	Endif
> > 	Unlock
> > Endif
> > END TRANSACTION	
> > 

> >
> > Please help me.
> >
> > Regards,
> > NIVEDITA
>
> You can FLUSH IN Alias FORCE for all affected tables after the END TRANSACTION
>
> Regards
> Tushar


Hello Tushar,

Thanks for the solution. I have question about this line "FLUSH IN Alias FORCE"
Q1: I have used tables like Acctmast,Tran etc. so i have to use flush command like this?
FLUSH IN Acctmast FORCE
FLUSH IN Tran FORCE

Q2: What is advantage of using this command? Will this command help in table or form corruption when the form is in run mode & there is record going to save into table & if power goes off?

Thanks you again

Regards,
NIVEDITA

ENTIRE THREAD

when & where to use flush command? Posted by Nivedita Joshi @ 7/16/2010 8:53:00 AM
RE: when & where to use flush command? Posted by tushar @ 7/16/2010 9:12:29 AM
RE: when & where to use flush command? Posted by Nivedita Joshi @ 7/16/2010 10:20:45 AM
RE: when & where to use flush command? Posted by tushar @ 7/16/2010 10:37:46 AM
RE: when & where to use flush command? Posted by Anil Sharma @ 7/16/2010 1:35:29 PM