🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How can I create Access table?

#2744
From: Ivo Karindi
Date: Fri, 28 Mar 2003 10:14
74 lines
3038 bytes
I am wrestling with similar issues currently. Your example helps a lot
in getting things cleared up a bit. Are there any sources (books,
tutorials, etc) on the 'net where I could learn some more of this
stuff? I am mostly interested in manipulating and retrieving data from
a MS Access database from a DLL. I got your DB making example working
wonderfully from my DLL and would like to learn more of this stuff.

Thanks a lot for your help,

Ivo Karindi



"Vladimir Afanasyev" <avv@systema.kiev.ua> wrote in message
news:3e808207$1@newsgroups.borland.com...
>
> Hi,
>
> "guba" <admin@coka.co.yu> wrote:
> >How can I create Access table?
>
> Next sample creates new Access database (c:/new.md) and
> adds new table (MyTable) in this database:
> (Some additional try, catch preferable)
>
> void __fastcall TForm1::Button1Click(TObject *Sender)
> {
> #define adVarWChar 202
> #define adInteger 3
>
> Variant Catalog;
> Variant Table;
> Variant TablesDataBase;
> Variant Columns;
>
> if(FileExists("C://New.mdb"))
>         {
>          ShowMessage("Database exist");
>          Application->Terminate();
>          return;
>         }
>
> Catalog=Variant::CreateObject("ADOX.Catalog");
> Table=Variant::CreateObject("ADOX.Table");
>
> try{
> Catalog.Exec(Function("Create") << "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C://New.mdb;");
> }
> catch(...)
> {
> //problems - may be database already exist
> }
>
>
> //Creating table
> Table.Exec(PropertySet("Name") << "MyTable");
>
> Columns=Table.Exec(PropertyGet("Columns"));
> Columns.Exec(Function("Append") << "ItsFirstField" << adVarWChar << 20);
> Columns.Exec(Function("Append") << "Next" << adInteger);
>
> //add table in database:
> TablesDataBase=Catalog.Exec(PropertyGet("Tables"));
> TablesDataBase.Exec(Function("Append") << Table);
>
> TablesDataBase=Unassigned;
> Columns=Unassigned;
> Table=Unassigned;
> Catalog=Unassigned;
>
> }
>
> Vladimir.
Technical Details
Message-ID: <3e8420b2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!ken-transit.news.telstra.net!news.telstra.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3e804d72@newsgroups.borland.com> <3e808207$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,1c113bcee69b4125
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-03-28 02:37:09 PST
Reply-To: "Ivo Karindi" <solk@ieslc.com>
From: "Ivo Karindi" <solk@ieslc.com>
Newsgroups: borland.public.cppbuilder.database.ado
References:  <3e804d72@newsgroups.borland.com> <3e808207$1@newsgroups.borland.com>
Subject: Re: How can I create Access table?
Date: Fri, 28 Mar 2003 12:14:40 +0200
Lines: 76
Organization: IESLC
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 213.35.136.182
Message-ID: <3e8420b2$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1048846514 213.35.136.182 (28 Mar 2003 02:15:14 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!ken-transit.news.telstra.net!news.telstra.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail