Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
'No parameter statement is found' in VFP3
Message
De
17/09/2003 02:06:58
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00828995
Message ID:
00829741
Vues:
29
Hi

Thank for your code, it is a good reference for me.

>>Hi,
>>
>>Does you mind sharing your opentbl function with me. Thank
>>
>
>********************************************************************
>*  Description.......: OpenTble && Opens the passed table
>*  Calling Samples...: OpenTble('TranMstr','WorkFile')
>*  Parameter List....: tcTable, tcAlias, tcMode, tcTagOrder, tnBufferMode
>*  Created by........:
>*  Modified by.......: Nadya Nosonovsky 05/01/2001 11:34:13 AM
>********************************************************************
>function OpenTble && Opens, but doesn't select a table
>lparameters tcTable, tcAlias, tcMode, tcTagOrder, tnBufferMode
>* tcTable - required: name of table to open (with or without full path)
>* tcAlias - optional: alias name, if different from tcTable
>* tcMode - optional:  mode in which table should be opened, like shared noupdate
>* tcTagOrder - optional: Tag name
>* tnBufferMode - optional: Set buffer mode
>local lcTableName, lnPos, llDBCPrefix, lcDBCName, lcPath
>* Check parameters first
>if vartype(m.tcTable)<>'C' or empty(m.tcTable)
>* First parameter is required
>	return .f.
>endif
>lnPos=rat('!',m.tcTable)
>if m.lnPos>0 && DataBase Name was specified && example: Support!PostOff
>	lcTableName=juststem(substr(m.tcTable,m.lnPos+1)) && PostOff
>	lcDBCName=upper(left(m.tcTable,m.lnPos-1)) && DBC Name
>	llDBCPrefix=.t.
>else
>	lcTableName=m.tcTable
>endif
>lcPath = justpath(m.tcTable)
>if vartype(m.tcAlias)<>'C' or empty(m.tcAlias)
>	tcAlias=juststem(m.lcTableName)
>endif
>
>if vartype(m.tcMode)<>'C' or empty(m.tcMode)
>	tcMode='shared'
>endif
>local lcCheckFile
>if empty(justext(m.lcTableName))
>	lcCheckFile=forceext(m.lcTableName,"dbf")
>else
>	lcCheckFile=m.lcTableName
>endif
>if !file(m.lcCheckFile)  && File doesn't exist
>	=messagebox(m.tcTable +' does not exist!. Can not proceed...',48,'Error')
>	return .f.
>endif
>local lnOldSelect
>lnOldSelect=select()
>if !used(m.tcAlias) or ; && Alias is not already in use or
>	(m.llDBCPrefix and not juststem(cursorgetprop("DATABASE",m.tcAlias))==m.lcDBCName) or ; && it's not the same database
>	(!empty(m.lcPath) and m.lcPath<>justpath(dbf(m.tcAlias)))
>	local lcOldError, lnErr, lcOldSetExclusive
>	use in select(m.tcAlias) && Close table && Nadya Nosonovsky 11/20/2001 02:58:33 PM allways
>	lnErr=0
>	lcOldError=on('error') && Save current Error Handler
>	lcOldSetExclusive=set('exclusive') && Save current exclusive status
>	set exclusive off && This should be always set this way
>	on error lnErr=error()
>	use (m.tcTable) again &tcMode in 0 alias (m.tcAlias)
>	on error &lcOldError && Restore previous Error Handler
>	if m.lcOldSetExclusive='ON'
>		set exclusive on && Restore it back to original settings
>	endif
>	do case
>	case m.lnErr=0 && Everything is OK
>	case m.lnErr=1705  && File Access is denied
>		=messagebox(m.tcTable +' is opened by another user. Can not proceed...',48,'Error '+transform(m.lnErr))
>		return .f. && Table could not be opened (already used exclusively)
>	otherwise && Another error
>		=messagebox(m.tcTable+' could not be opened!',48,'Error '+transform(m.lnErr))
>		return .f.
>	endcase
>endif
>select (m.tcAlias) && If it's here, everything is all right
>if not empty(m.tcTagOrder) and vartype(m.tcTagOrder)='C' and tagno(m.tcTagOrder)>0
>	set order to tag (m.tcTagOrder) in (m.tcAlias)
>endif
>if vartype(m.tnBufferMode)='N' and between(m.tnBufferMode,1,5)
>	set multilocks on
>	=cursorsetprop('Buffering',m.tnBufferMode) && Note, we can not set buffering mode less than 3 on a view - no check for this
>endif
>select (m.lnOldSelect) && Return back to the original area
>return .t.
Best Regards
Virusim
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform