🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.multi-tier
4 messages
4 total messages Started by Brian Phillips Wed, 19 Apr 2000 00:00
Copying *.DBF files
#1238
Author: Brian Phillips
Date: Wed, 19 Apr 2000 00:00
40 lines
2515 bytes
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
------------------------------------------------------------------------
Re: Copying *.DBF files
#1239
Author: Dirk Schwammkrug
Date: Thu, 20 Apr 2000 00:00
55 lines
3101 bytes
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
> ------------------------------------------------------------------------
Re: Copying *.DBF files
#1240
Author: 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
------------------------------------------------------------
Re: Copying *.DBF files
#1106
Author: Dirk Schwammkrug
Date: Tue, 25 Apr 2000 00:00
96 lines
4771 bytes
Hi Brian,

> that program interacts with other parts of our system. I
> need to emulate the original programmer's output exactly.

now I see clearer. You could try it anyway, despite that
constraint. If the other parts of your system talk to the
database in "dbase" language, they won't mind the additional
fields in the record structure. I once wrote an application
that had to operate in parallel to a CLIPPER based DOS
application on the same DBASE III+ tables and it worked for me. 

best regards,
Dirk


Brian Phillips wrote:
> 
> 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
> ------------------------------------------------------------

-- 
_________________________________________________
Dirk Schwammkrug
Computer Scientist R & D
Chemspeed Ltd, CH-Augst, http:\\www.chemspeed.com
Phone: (+41)61-8169-640  Fax: [..]-509
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads