🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #2315

Create a new table

#2315
From: Lee
Date: Sun, 17 Aug 2003 19:57
38 lines
2134 bytes
Hello all,

I am trying to create a new table within a database file that I just created
using this code:
Form1->Catalog.Exec(Function("Create") <<
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Tests.DBF"));

(I would like to use an access file, but will settle for a DBase file. it
appears that NewTable->TableType = ttDBase; does not have an Access table
listing)

I can create a table using this code:
TTable *NewTable = new TTable(Form1);
NewTable->Active = false;
NewTable->TableName = "Tests";
NewTable->TableType = ttDBase;
NewTable->FieldDefs->Clear();
TFieldDef *NewField = NewTable->FieldDefs->AddFieldDef(); // define first
field
NewField->DataType = ftInteger;
NewField->Name = "SID";
NewField = NewTable->FieldDefs->AddFieldDef(); // define second field
NewField->Name = "First";
NewField->DataType = ftString;
NewField->Size = 15;
TIndexDef *NewIndex = NewTable->IndexDefs->AddIndexDef(); // add an index
NewIndex->Name = "Tests";
NewIndex->Options << ixPrimary << ixUnique;
NewTable->CreateTable();

How do I create a table in the database that I just created..

If I can not create a table in the database, how can I open the new
standalone table?

Thanks, and sorry for the long post.

Lee
Technical Details
Message-ID: <3f3fde36$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,5ff793e5206e9a54,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-08-17 13:11:00 PST
From: "Lee" <gobroski@elltel.net>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Create a new table
Date: Sun, 17 Aug 2003 12:57:51 -0700
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 12.18.161.26
Message-ID: <3f3fde36$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1061150262 12.18.161.26 (17 Aug 2003 12:57:42 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail