🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.multi-tier
8 messages
8 total messages Started by Brian Phillips Wed, 26 Apr 2000 00:00
Copying *.DBF files
#1109
Author: Brian Phillips
Date: Wed, 26 Apr 2000 00:00
30 lines
1937 bytes
------------------------------------------------------------
Hi *;
         I'm using a *.DBF and *.CDX files to start with. Every time I
run my program I need to create a new database file by a click of a
mouse button and populate it. Within my program I've been trying to
create a new database file.  My best attempt has been to copy a blank
*.DBF and *.CDX, using a system command, in order to create a new *.DBF
and *.CDX with a new name.  Then I make the "Ttable Active" property
"false", rename the "Ttable TableName" property, and finally I make the
"Ttable Active" property "true". This does not seem to work because as
far as builder is concerned new database files seems to be corrupt.  I
need to create the file by getting the system command working or by
another whole new method.  I am open to new methods of creating this
file.  For anyone who could put me on a track that would lead to the
creation of this file I thank!
                                             Brian


Here is an example of what I'm trying now.
This is not working. 
I get corrupt files.

String  NewFileName;
NewFileName  =  UserEntered->Text;
system("copy C:\\BlankFile.dbf  C:\\NewFileName.dbf");
system("copy C:\\BlankFile.cdx  C:\\NewFileName.cdx");
ATable->Active = false;
ATable->TableName = "NewFileName.dbf";
ATable->Active = true;
------------------------------------------------------------
Re: Copying *.DBF files
#1113
Author: Mark Cashman (TeamB)
Date: Fri, 28 Apr 2000 00:00
16 lines
1178 bytes
Hi, Brian!

The problem with dBase style files is that the index apparently seems to
know the name of the file with which it is associated, which is where
the "corruption" comes in.

More than that, I can't really say. Any reason not to use the maintained
index file (.mdx)? I think the AddIndex from the VCL will create that if
it isn't present.

------
Mark Cashman, TeamB C++ Builder
http://www.temporaldoorway.com/programming/index.htm
C++ Builder, JBuilder programming information
Home of The C++ Builder Programmer's Webring - Join us!
------
Re: Copying *.DBF files
#1118
Author: sandrews
Date: Tue, 02 May 2000 00:00
18 lines
1254 bytes
"Mark Cashman (TeamB)" wrote:
> 
> Hi, Brian!
> 
> The problem with dBase style files is that the index apparently seems to
> know the name of the file with which it is associated, which is where
> the "corruption" comes in.
> 
> More than that, I can't really say. Any reason not to use the maintained
> index file (.mdx)? I think the AddIndex from the VCL will create that if
> it isn't present.
> 

Actually the information about an attached MDX index is in the dbf.  If
you
have a look at the information about the dbf layout on borland`s site it
will explain it.  You can reset that byte in the dbf header and then it
shouldn`t complain.
Re: Copying *.DBF files
#1120
Author: Mark Cashman (TeamB)
Date: Tue, 02 May 2000 00:00
8 lines
952 bytes
You're right about that. It was so long ago, I had forgotten.

------
Mark Cashman, TeamB C++ Builder
http://www.temporaldoorway.com/programming/index.htm
C++ Builder, JBuilder programming information
Home of The C++ Builder Programmer's Webring - Join us!
------
Copying *.DBF files
#1123
Author: Brian Phillips
Date: Wed, 03 May 2000 00:00
31 lines
1663 bytes
Hi Everyone;
         Thank you for all your help!!!!!!!
        It doesn't seem to be an index problem.  Borland 
will not recognize all the field names of the new database. 
Here is the structure of the *.DBF file.

Blank Database
SCHOOL	       Character	3	0	
STUDNO	       Character	9	0	
SEMESTER       Character	1	0	
DATE	       Date	        8   	0	
DAY	       Character	1	0	
TYPE	       Character	1	0	
EDITCODE       Character	1	0	
ENTER  	       Character	5	0	
LEAVE	       Character	5	0

CDX Index
STUDNO

          Every time I use the system copy C++ Builder 
does not seem to recognize the "ENTER" or the "LEAVE" 
fields.  I need one of three things. One - I need to 
learn how to use the system command correctly. Two - I 
need to learn another way to copy and activate files 
within my code.  Three - I need to learn to create a 
new *.DBF files with in my code.
          Brian

	
---------------------------------------------------------------
Re: Copying *.DBF files
#1124
Author: Mark Cashman (TeamB)
Date: Wed, 03 May 2000 00:00
10 lines
1028 bytes
Hi, Brian!

When you say "system copy" do you mean TBatchMove?

------
Mark Cashman, TeamB C++ Builder
http://www.temporaldoorway.com/programming/index.htm
C++ Builder, JBuilder programming information
Home of The C++ Builder Programmer's Webring - Join us!
------
Re: Copying *.DBF files
#1125
Author: Brian Phillips
Date: Thu, 04 May 2000 00:00
30 lines
1909 bytes
Hi Mark;
       Thanks for the help.  What I mean is below.
Example:
******************************************************
1) String  NewFileName;
2) NewFileName  =  UserEntered->Text;
3) system("copy C:\\BlankFile.dbf  C:\\NewFileName.dbf");
4) system("copy C:\\BlankFile.cdx  C:\\NewFileName.cdx");
5) ATable->Active = false;
6) ATable->TableName = "NewFileName.dbf";
7) ATable->Active = true;
*******************************************************
      I use the 'system' command on lies 3 & 4 to invoke 
the DOS command 'copy'.
With this I try to copy empty files as a way of creating 
a new  empty *.DBF & *.CDX files to be later populated.
There could easily be a better way of doing this that I
don't know about.  Thanks for all your time.
                        Brian
====================================================
Mark Cashman (TeamB) wrote: Hi, Brian!
 
When you say "system copy" do you mean TBatchMove?
 
------
Mark Cashman, TeamB C++ Builder
http://www.temporaldoorway.com/programming/index.htm
C++ Builder, JBuilder programming information
Home of The C++ Builder Programmer's Webring - Join us!
------
Re: Copying *.DBF files
#1131
Author: Mark Cashman (TeamB)
Date: Mon, 08 May 2000 00:00
16 lines
1411 bytes
If that doesn't work, you could try using TBatchMove with batCopy. If
the table doesn't exist, TBatchMove creates it. But I believe you have
to create the specific indexes programatically afterward with AddIndex.

You may wish to continue this thread over in
borland.public.cppbuilder.database.desktop which is more suited to this
desktop database topic.

Thanks.

------
Mark Cashman, TeamB C++ Builder
http://www.temporaldoorway.com/programming/index.htm
C++ Builder, JBuilder programming information
Home of The C++ Builder Programmer's Webring - Join us!
------
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