Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening all Database in program

Status
Not open for further replies.

giridpi

Programmer
Dec 5, 2003
33
0
0
IN
I want chenge my all data base Extension. Like main.dbf to main fdb for secuirty purpose. I am using more than 150 files. so how can i changein single program.

Thank u

Giri
 
Giridpi,
try
!rename *.dbf *.fdb
or similarly, backup first!
Tesar
 
Giri,
You do realize that the programs now will have to explicitly USE the .FDB file? i.e. instead of:
USE myfile
you'll need:
USE myfile.FDB

Note: Don't change the .CDX or .FPT files, there isn't an easy way to use variants on these!

Do you really think that this is a real "security" solution?

Rick
 
Thank U,

I know its not real security.

Giri
 
"how can i change in single program"

A single Foxpro application (a.k.a. "program") is typically made up of many PRG files and possibly Menus and/or Screens.

There is no "quick & easy" way to make the changes everywhere within all of the source files.

The changes that Rick mentions would need to be made in ALL of the source files (PRG's, Screens, Menu's, etc.) where data tables were USE'd.

Then the Project would need to be Re-Built to implement the new code.

You could use the Windows Search/Find utility to locate where the text USE <TableName> appeared all of the files in your source directory. Then go into those source files and make the necessary changes.

Alternatively you could make a new
Function OpenFDB
PARAMETER ThisDBF
PRIVATE mcFDB
mcFDB = ThisDBF + &quot;.FDB&quot;
USE (mcFDB) IN 0
RETURN

but you would still need to replace all occurances of
USE MyTable
with
=OpenFDB('MyTable')
so it does not get around the number of changes required.

Good Luck,


JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
Here is an ugly hack for you to consider using if you are desparate.
Basically, what it does is opens a '.fdb' file using the original .dbf name as an alias if error number 1 (&quot;File not found&quot;) occurs. Otherwise, you can continue normal error processing.
Just use this snippet in your normal error routine:
Code:
*... assuming PARAMETERS statement looks like this:
*...   PARAMETERS merror, msg, mess1, mlineno

IF merror = 1     
   STORE SUBSTR(msg, 7, AT(&quot;'&quot;, SUBSTR(msg, 7)) -5) + '.fdb' TO fdbTable
   STORE juststem(justfname(fdbTable)) TO cAlias
   USE (fdbTable) ALIAS (cAlias)
ENDIF

It may take a little twiddling, but like I said. You can try it if you're desparate.
It does require you to have a SET LIBRARY TO FOXTOOLS.FLL somewhere in your app though.


-Dave S.-
[cheers]
Even more Fox stuff at:
 
In case he's using FPD or doesn't want to use FoxTools.FLL, you can use this code-only routine from GENXTAB.PRG (thanks Fox Software!):
Code:
*!*********************************************************************
*!
*!       Function: JUSTSTEM()
*!
*!      Called by: GENXTAB.PRG                   
*!
*!*********************************************************************
FUNCTION juststem
* Return just the stem name from &quot;filname&quot;
PARAMETERS filname
PRIVATE ALL
IF RAT('\',m.filname) > 0
   m.filname = SUBSTR(m.filname,RAT('\',m.filname)+1,255)
ENDIF
IF AT(':',m.filname) > 0
   m.filname = SUBSTR(m.filname,AT(':',m.filname)+1,255)
ENDIF
IF AT('.',m.filname) > 0
   m.filname = SUBSTR(m.filname,1,AT('.',m.filname)-1)
ENDIF
RETURN ALLTRIM(UPPER(m.filname))
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top