files on external drives

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
Templar
Posts: 34
Joined: Sun Apr 01, 2018 5:37 pm
DBs Used: DBF
Has thanked: 1 time
Been thanked: 2 times

files on external drives

Post 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

User avatar
andyglezl
Posts: 1215
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 37 times
Been thanked: 91 times
Contact:

Post 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.
Andrés González López
Desde Guadalajara, Jalisco. México.

User avatar
mol
Posts: 3273
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 240 times
Been thanked: 143 times
Contact:

Post 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.

User avatar
mol
Posts: 3273
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 240 times
Been thanked: 143 times
Contact:

Post 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")

User avatar
AUGE_OHR
Posts: 660
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 85 times
Been thanked: 161 times

Post 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. :?:
have fun
Jimmy

User avatar
SALINETAS24
Posts: 394
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Has thanked: 31 times
Been thanked: 29 times

Post 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....
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:

Post Reply