
Cannot create table
Ne peut pas créér la table
Q 1: J'utilise une table temporaire dans certains
de mes rapports. Avec un seul utilisateur, tout va bien. Quand deux utilisateurs ouvrent
le même rapport, en multi-utilisateur, une erreur "cannot create table"
Y-a-t-il un moyen de contourner ceci.
R 1.1 par Michael Nuwer :
Dans TMPQuery.cc chercher la méthode "setFullPath» et la remplacer par la
suivante (attention aux retours à la ligne).
function setFullPath
********************
*- Type: Internal
*- Purpose: Sets path and file name of table, custom
// properties determine path and file name
*- Return: Success on setting full path (Logical)
local bPath, cPath, nLen, n
bPath = true
this.fullPath = null
do case
case this.userDefPath
cPath = getDirectory()
if EMPTY(cPath)
bPath = false
endif
case this.useTempPath
if type("GetTempPath") # "FP"
extern culong GetTempPath(culong,
cstring) kernel32 ;
from "GetTempPathA"
endif
cPath = SPACE(256)
nLen = cPath.length
n = GetTempPath(nLen, cPath)
if n > nLen
nLen = n
n = GetTempPath(nLen, cPath)
endif
if n > 0
cPath = cPath.left(nLen)
else
cPath = SET("Directory")
endif
otherwise
cPath = SET("Directory")
endcase
if bPath
if cPath.right(1) # "\"
cPath += "\"
endif
if empty(this.tablename)
//////////////////////////////////////////////
//The next two lines modifided by Michael Nuwer (Jan. 2010)
this.fullPath = FUNIQUE(cPath + this.skeleton +
".dbf")
this.fullPath = left(this.fullPath,at('.',this.fullPath)-1)
else
this.fullPath = cPath + this.tableName
endif
if EMPTY(this.fullPath)
MSGBOX("Impossible de créer la table unique",
"Annulé", 48)
bPath = false
endif
endif
return bPath |
R 1.2 par Charles:
J'utilise ceci :
** fullPath = the path to
the file(s)
FOR j4 = 0 to 9999
j5 = fullPath + "TEMP" + right("0000" + ltrim(str(j4)),
4)
IF .NOT. file("&j5..dbf")
form.this_file = j5
EXIT
ENDIF
NEXT |
Cela permet à mon application d'avoir jusqu'à 9.999 fichiers temporaires ouvert à
tous les utilisateurs - Je n'ai jamais eu (en plus de 17 ans) un utilisateur empêché
d'exécuter des fichiers de travail temporaire. Être sûr que l'application efface le
fichier (form.this_file) lorsque l'utilisateur a terminé avec elle (peut-être lorsque
vous fermez le formulaire).
retour
Sources :
Aide dBase Plus 2.6.0
Q1
From: "emeka ossai" <megameks@yahoo.com>
Newsgroups: dbase.getting-started
Sent: Tuesday, March 16, 2010 12:03 AM
Subject: multiuser error |
|
|
|
Retour à l'accueil
Les informations de cette page sont données à titre indicatif et ne se substituent
pas à celles contenues dans l'Aide de votre version de dBase qui reste la meilleure
documentation.
Si vous voyez des erreurs, ou souhaitez apporter des compléments, n'hésitez pas à le signaler.
Dernière modification : samedi 05 novembre 2011
© M.Abraham.
|