Hi !
It seems that it's a problem with this class . I reviewed and found that in Open method it can't open temporary dbf . It seems that this is related to this :
DEFAULT ::cFileName := cTempFile(GetEnv("TEMP"),"DBF")
This GetEnv() work OK ?
With best regards ! Rimantas .
TDbOdbcDirect problem
TDbOdbcDirect problem
Rimantas U.
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Try this to get the temp directory.
Code: Select all
// Returns path to windows temp directory
GetTempDir()
local cDir := GetEnv("TEMP")
if empty(cDir)
cDir := GetEnv("TMP")
endif
if Right( cDir, 1 ) == "\"
cDir = SubStr( cDir, 1, Len( cDir ) - 1 )
endif
if !empty(cDir)
if !lIsDir(cDir)
cDir := GetWinDir()
endif
else
cDir := GetWinDir()
endif
return cDir
Hello James ! Thanks for your reply . But I found that the problem isn't here . It's cTempFile() function :
function cTempFile() // returns a temporary filename
local cFileName
static cOldName
while File( ( cFileName := StrTran( Time(), ":", "" ) ) ) .or. ;
cFileName == cOldName
end
cOldName = cFileName
return cFileName
This function is without incoming arguments .
METHOD Open() CLASS TDbOdbcDirect
local aFields
local nLen, n
DEFAULT ::cFileName := cTempFile(GetEnv("TEMP"),"DBF") ,;
::cAlias := ""
In TDbOdbcDirect method Open() this function is with arguments . But the arguments isn't working and I get an error :
Error description: Error DBCMD/1010 Illegal characters in alias: ::cAlias
Called from DBUSEAREA(0)
Called from TDBODBCDIRECT:OPEN(0)
Antonio , do you have correct version of this function ?
With best regards ! Rimantas .
function cTempFile() // returns a temporary filename
local cFileName
static cOldName
while File( ( cFileName := StrTran( Time(), ":", "" ) ) ) .or. ;
cFileName == cOldName
end
cOldName = cFileName
return cFileName
This function is without incoming arguments .
METHOD Open() CLASS TDbOdbcDirect
local aFields
local nLen, n
DEFAULT ::cFileName := cTempFile(GetEnv("TEMP"),"DBF") ,;
::cAlias := ""
In TDbOdbcDirect method Open() this function is with arguments . But the arguments isn't working and I get an error :
Error description: Error DBCMD/1010 Illegal characters in alias: ::cAlias
Called from DBUSEAREA(0)
Called from TDBODBCDIRECT:OPEN(0)
Antonio , do you have correct version of this function ?
With best regards ! Rimantas .
Rimantas U.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Rimantas,
Please try this cTempFile() source code:
Please try this cTempFile() source code:
Code: Select all
function cTempFile( cPath, cExtension ) // returns a temporary filename
local cFileName
static cOldName
DEFAULT cPath := "", cExtension := ""
if ! "." $ cExtension
cExtension = "." + cExtension
endif
while File( cFileName := ( cPath + StrTran( Time(), ":", "" ) ) + cExtension ) .or. ;
cFileName == cOldName
end
cOldName = cFileName
return cFileName
Excuse me , Antonio , the function is working OK ) . I forget to set DBFFPT lib , because some fields in SQL database are as "MEMO" and so USE command didn't worked . Today I found the reason of that problem and now all is working OK . Your TDBOdbcDirect works fine now .. )Antonio Linares wrote:Rimantas,
Please try this cTempFile() source code:
[/code]
With best regards ! Rimantas .
Rimantas U.