🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.multi-tier
Article #1240

Re: Copying *.DBF files

#1240
From: Brian Phillips
Date: Thu, 20 Apr 2000 00:00
71 lines
3920 bytes
Hi Dirk;
        I understand your concern about copying the index 
and memo files connected to the original file. Thank you.
        I also understand your recommendation of changing 
the database structure but I do not have that choice.  I 
am replacing an existing DOS based program. The output of 
that program interacts with other parts of our system. I 
need to emulate the original programmer's output exactly. 
So that means for every date the program runs I need to 
create two new database files and populate them. I can't 
seem to create two new database files without them being 
corrupt.
       Thank you or anyone else who can help.
           Brian
------------------------------------------------------------
Dirk Schwammkrug wrote:
Hi Brian,
    If the tables contain memo fields, you must copy the 
corresponding *.DBT files also. Same applies for index 
files if you use any.
    Despite that, why don't you just add a date field to 
the database structure to hold the "editing date"? It would 
make queries simpler, especially those of type "what did I 
edit last week?" when the date your program requires is 
connected with the calendar. Just curious.    
   hope it helps,
      Dirk
------------------------------------------------------------ 
Brian Phillips wrote:
Hi;
    I'm using a *.DBF file to start with.  I am writing 
a program that creates two output database files for 
every  date that the users enter when running the program. 
In  other words - A user will open the program and have to 
enter a date on the screen before they can do any data 
entry  or run any reports.  When the users enters a date 
into the program I use the date to create the name of the 
two database  files.  If they do exists I will just activate 
the database  files for user access. If they do not exist I 
will create  them and then activate the database files for 
user access.
   I'm currently using the DOS 'system' command to copy a 
blank database and assigning it the right new name.  Then 
I make the 'Ttable Active' property "false", renaming the 
'TableName' property of the 'TTable', and finally I make 
the 'Ttable Active' property "true". Here is an example.

String date, NewFileNameI, NewFileNameII;
date = DateFromTheUser->Text;
Convert(date, NewFileNameI, NewFileNameII);
system("copy C:\\BlankFileI.dbf  C:\\NewFileNameI.dbf");
system("copy C:\\BlankFileII.dbf  C:\\NewFileNameII.dbf");
ATable->Active = false;
ATable->TableName = "NewFileNameI.dbf";
ATable->Active = true;
BTable->Active = false;
BTable->TableName = "NewFileNameII.dbf";
BTable->Active = true;

    I am able to open the new databases.  When I go to 
write records to these new files I receive errors letting 
me know that builder can not find certain fields within 
the database. It can find most of the fields but not all 
of them.  If I look at the new databases through other 
software I can see all the fields are there.
   I'm happy to fix this problem working with my current 
code or I'm just as happy to trash it all for another 
solution that will work.  For anyone who could put me on 
a track that would lead to another answer I thank you now!!!
                           Brian
------------------------------------------------------------
Technical Details
Message-ID: <38FF25E4.328F@csc.sctboces.org>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <38FE3A47.2FAA@csc.sctboces.org> <38FEDE15.EA2B6CD1@gmx.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fcd2b,e196898ec15db7fc
X-Google-Attributes: gidfcd2b,public
From: Brian Phillips <bphillip@csc.sctboces.org>
Subject: Re: Copying *.DBF files
Date: 2000/04/20
Message-ID: <38FF25E4.328F@csc.sctboces.org>
X-Deja-AN: 613563576
Content-Transfer-Encoding: 7bit
References: <38FE3A47.2FAA@csc.sctboces.org> <38FEDE15.EA2B6CD1@gmx.net>
Content-Type: text/plain; charset=us-ascii
X-Trace: 20 Apr 2000 05:38:18 -0800, 216.42.90.67
Organization: SCT BOCES
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.database.multi-tier