Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: mike castillo
  Where is mike castillo?
 Joo Seng Road, Singapore
 Philippines
 mike castillo
 To: Anup Singh
  Where is Anup Singh?
 Delhi
 India
 Anup Singh
 Tags
Subject: RE: Duplicate Bill No.
Thread ID: 209644 Message ID: 209647 # Views: 58 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Windows Vista and VFP
Date: Tuesday, December 30, 2008 8:57:00 AM         
   


You should be locking the tranfile not the gernal table

It should look something like this:

SET EXCLUSIVE OFF 
SET MULTILOCKS ON 
SET REPROCESS TO 20 
SELECT 0
USE test
IF SEEK("10","test","fld1")
	RLOCK() 
	*== Processing here
	replace fld2 WITH fld2 + 1
	*====
	UNLOCK ALL 
ENDIF 


Basing from your code, Do while is not proper in that approach since you are just returning a "fond" variable value which is "Y" from between that loop unless you got other process but that is not the case, you can go directly to seek that particular record and lock it.

Hope this helps.

Kind regards,
Mike

> Dear Friends
>
> I am suffering with a very serious problem of bill number duplication.
>
> I am using free tables (.dbf) files
>
>
>
> sele gernal
> =rlock()
> sele tranfile
> set filt to
> set order to mdisvc
> fond="N"
> do while fond="N"
>   	seek billnumber
> 	if .not. found()
>     	fond="Y"
>   	else
>   		billnumber=billnumber+1
> 	endif
> enddo
> appe blan
> =rlock()
> repl bill with billnumber
> unlock all
> 

>
> I lock record in "gernal" file so that if any user want to add bill record in "tranfile" he will wait upto unlock. When i complete all the transaction then i issue "unlock all" to free all the tables for all and next user can save.
>
> Not often, but daily 1 or 2 bills generated with a duplicate number in multiuser platform.
>
> Please suggest me.
>
> With regard
> Anup Singh
> (M.D.)
> MARG Compusoft Pvt. Ltd.
>
> Email:anupmarg@gmail.com
> Web:www.margcompusoft.com

ENTIRE THREAD

Duplicate Bill No. Posted by Anup Singh @ 12/30/2008 8:34:42 AM
RE: Duplicate Bill No. Posted by mike castillo @ 12/30/2008 8:57:00 AM
RE: Duplicate Bill No. Posted by tushar @ 12/30/2008 9:08:55 AM
RE: Duplicate Bill No. Posted by Anil Sharma @ 12/30/2008 9:15:14 AM
RE: Duplicate Bill No. Posted by tushar @ 12/30/2008 9:34:36 AM
RE: Duplicate Bill No. Posted by Anil Sharma @ 12/30/2008 9:44:08 AM
RE: Duplicate Bill No. Posted by tushar @ 12/30/2008 2:29:07 PM
RE: Duplicate Bill No. Posted by mike castillo @ 12/31/2008 2:31:15 AM
RE: Duplicate Bill No. Posted by tushar @ 12/31/2008 6:04:54 AM
RE: Duplicate Bill No. Posted by Anders Altberg @ 12/31/2008 12:37:54 PM
RE: Duplicate Bill No. Posted by Anil Sharma @ 1/2/2009 9:06:24 AM
RE: Duplicate Bill No. Posted by Anders Altberg @ 1/2/2009 11:40:02 AM
RE: Duplicate Bill No. Posted by Anup Singh @ 1/2/2009 9:46:35 AM
RE: Duplicate Bill No. Posted by Jag Pal Sharma @ 2/2/2016 12:32:58 PM
RE: Duplicate Bill No. Posted by Tore Bleken @ 2/2/2016 12:48:00 PM
RE: Duplicate Bill No. Posted by Anders Altberg @ 1/2/2009 2:18:18 PM
RE: Duplicate Bill No. Posted by Anil Sharma @ 1/3/2009 7:58:04 AM
RE: Duplicate Bill No. Posted by anand kulkarni @ 2/4/2016 8:28:08 AM
RE: Duplicate Bill No. Posted by Tore Bleken @ 2/4/2016 8:58:38 AM
RE: Duplicate Bill No. Posted by anand kulkarni @ 2/4/2016 10:49:02 AM