Page 1 of 3

files on external drives

Posted: Wed Mar 25, 2020 5:12 pm
by Templar
Can you "USE" a data file off a different drive?

eg: ( If my installation is on C:\ drive )
A command like USE E:\BOOKS\AUTHORS.dbf
will not actually open the file. It can find it okay, so:

IF FILE("E:\BOOKS\AUTHORS.dbf")
USE E:\BOOKS\AUTHORS.dbf
ELSE
< Display some error message >
ENDIF
does not display the error message, but it does nothing!!
Any suggestions how to get round this?
Templar

Re: files on external drives

Posted: Wed Mar 25, 2020 7:06 pm
by andyglezl
Porque utilizar la letra de la unidad ?

Cuando ejecutas tu programa, asume que tus bases de datos se encuentran
en la carpeta (o tu le indicas las subcarpetas ) de donde está arrancando.

Si te fijas, todos los ejemplos de HMG,
NO UTILIZAN la letra de la unidad.

USE AUTHORS

Debería de ser suficiente.
*-------------------------------------------------------------------------------------------------
Why use the drive letter?

When you run your program, assume that your databases are
in the folder (or you indicate the subfolders) where it is booting from.

If you look, all the HMG examples,
DO NOT USE the drive letter.

USE AUTHORS

It should be enough.

Re: files on external drives

Posted: Wed Mar 25, 2020 7:40 pm
by mol
try to use

Code: Select all

SET PATH TO E:\BOOKS
you can also use list of your locations separated by semicolon

You can also use SET DEFAULT TO [xcPatspec]

Sample from Clipper 5 manual:

Code: Select all

set default to e:\books
? file("authors.dbf")    //result: .T.

Re: files on external drives

Posted: Wed Mar 25, 2020 7:53 pm
by mol
Templar wrote:
Wed Mar 25, 2020 5:12 pm
Can you "USE" a data file off a different drive?

eg: ( If my installation is on C:\ drive )
A command like USE E:\BOOKS\AUTHORS.dbf
will not actually open the file. It can find it okay, so:

IF FILE("E:\BOOKS\AUTHORS.dbf")
USE E:\BOOKS\AUTHORS.dbf
ELSE
< Display some error message >
ENDIF
does not display the error message, but it does nothing!!
Any suggestions how to get round this?
Templar

The simplest way is to use DbUseArea("e:\books\authors.dbf")

Re: files on external drives

Posted: Wed Mar 25, 2020 8:33 pm
by AUGE_OHR
hi,

you talk about external Drive ... is it a USB-Drive or Network-Drive :?:

if USB-Drive : check Attribut if File have "R"eadonly Flag
can you open that DBF when copy to your Home-Directory. :?:

Re: files on external drives

Posted: Wed Mar 25, 2020 9:01 pm
by SALINETAS24
Hola Auge.., igual es esto lo que buscas.

Code: Select all


cFile:="E:\BOOKS\AUTHORS.dbf"

IF FILE("E:\BOOKS\AUTHORS.dbf")
	USE (cFile)
ELSE
    < Display some error message >
ENDIF

Abrazos virtuales.., y vamos con la cervecita....

Re: files on external drives

Posted: Sun Mar 29, 2020 4:15 pm
by Templar
Thanks to everyone for suggestions. Let me explain more.
I am writing a program to install my main package elsewhere. So first I copy all the necessary files from the C:\ drive onto the flashdrive at E:\. Then I want to open one of those files off the flashdrive.
Andyglezl: thanks, but I can't change the default, because I am still using files off C:\ as well.
Mol: Thanks but same thing. I need to use files off two different drives
Auge_ohr: Nope! Checked the Read Only flag. It isn't set
Salenitas24: Thanks, but actually I am enfolding it in a variable. I just simplified it for my example!

The file is certainly there: I can see it in File Explorer and the program checks it is there before trying to open it. So what happens is that it goes through "USE books.dbf" with no error message, but then "GO TOP" produces an error message: "Workarea not in use"

It's odd!
Templar

Re: files on external drives

Posted: Sun Mar 29, 2020 4:33 pm
by serge_girard
Templar,

File is maybe corrupt?
Try another file.

Serge

Re: files on external drives

Posted: Sun Mar 29, 2020 5:46 pm
by mol
Try to prepare working sample producing error.
Some of us have a lot of time now...

Re: files on external drives

Posted: Sun Mar 29, 2020 7:16 pm
by RPC
mol wrote:
Sun Mar 29, 2020 5:46 pm
Some of us have a lot of time now...
Hi mol
Maybe you can help in my memory problem which I posted here ;)
Rajeev