Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Tableupdate()
Message
De
01/03/2016 07:09:59
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
29/02/2016 13:04:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01632291
Message ID:
01632333
Vues:
47
I notice the following commands:
if !result
				= aerror(laerror)
				tablerevert( .t., "sales" )
...
I suggest you don't revert automatically, and let the user press a "Cancel" button. The reason is that some errors - such as a duplicate primary key - can be corrected by the user, so in this case, a cancel won't be necessary.

>Dear Expert
>
>I am trying to convert my single user system to multiuser system.
>
>I wrote follwing codes behind SAVE button.
>
>Do not know that are reliable or not.
>
>Please review and help me
>
>
>sno1=thisform.text1.value
>	date1=thisform.text2.value
>	code1=thisform.text4.value
>	partyname=thisform.text5.value
>
>*--- delete current invoice if found
>	select sales
>	delete all for sno=thisform.text1.value in sales
>	tableupdate(.t.,.t.,'sales')
>
>*--- get NEW sno (refresh sno if some one has saved invoices greater than text1.value)
>	maxsno=0
>	calculate max(sno) for !deleted() to maxsno
>	thisform.text1.value=maxsno+1
>
>	Begin transaction
>
>		*---prepare credit entry
>			select  temp
>			repl all credit with round(credit,0),type with [P],detail with thisform.text3.value,;
>				sno with thisform.text1.value,dates with date1,	code2 with code1,;
>				credit with round(credit,0),edmode with .t. for !empty(codes)
>
>			update temp set names =products.names from products where temp.codes=products.codes
>
>			select sales
>			append from dbf("temp")  for !empty(codes) and !deleted()
>
>			result=tableupdate(.t.,.t.,'sales')
>			
>			*---error trapping routine
>			if !result
>				= aerror(laerror)
>				tablerevert( .t., "sales" )
>				= messagebox('Error #' + ltrim(str(laerror[1])) + ': ' + laerror[2] + ;
>					' occurred while saving.')
>			endif result
>
>		*---prepare debit entry
>			select temp
>			repl all code2 with codes, codes with code1,names with partyname,detail with thisform.text3.value,;
>				sno with thisform.text1.value,debit with round(credit,0),;
>				credit with 0 type with "" ,edmode with .t. for !empty(codes)
>
>			select sales
>			append from dbf("temp")  for !empty(codes) and !deleted()
>
>			result=tableupdate(.t.,.t.,'sales')
>
>			*---error trapping routine
>			if !result
>				= aerror(laerror)
>				tablerevert( .t., "sales" )
>				= messagebox('Error #' + ltrim(str(laerror[1])) + ': ' + laerror[2] + ;
>					' occurred while saving.')
>			endif result
>
>	end transaction
>
>	flush in sales force
>
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform