Article View: borland.public.cppbuilder.database.ado
Article #1973How to use ADOX to link tables in MS Access
From: Pat
Date: Thu, 08 Jan 2004 11:29
Date: Thu, 08 Jan 2004 11:29
46 lines
2483 bytes
2483 bytes
Hi, looking past post I learn how to create a new table in a MS Access database, and I create 3 tables (named CatTable, FotTable, PtsTable) as the following: // Creation CatTable TADOCommand *Cmd1 = new TADOCommand(0); Cmd1->CommandText = "CREATE TABLE "+ CatTableName +" ([ID] AutoIncrement NOT NULL, [Nome] Text NULL)"; Cmd1->Connection = ADOConnection; Cmd1->Execute(); delete Cmd1; // Creation FotTable TADOCommand *Cmd2 = new TADOCommand(0); Cmd2->CommandText = "CREATE TABLE "+ FotTableName +" ([ID] AutoIncrement NOT NULL, [NomeFotog] Text NULL, [X] double NULL, [Y] double NULL)"; Cmd2->Connection = ADOConnection; Cmd2->Execute(); delete Cmd2; // Creation PtsTable TADOCommand *Cmd3 = new TADOCommand(0); Cmd3->CommandText = "CREATE TABLE "+ PtsTableName +" ([ID] AutoIncrement NOT NULL, [IDCat] integer NOT NULL, [X] double NULL, [Y] double NULL, [Z] double NULL, [SigmaX] double NULL, [SigmaY] double NULL, [SigmaZ] double NULL, [IDFotog] integer NULL, [Note] Text NULL)"; Cmd3->Connection = ADOConnection; Cmd3->Execute(); delete Cmd3; But now I have to link them. In particular: - in PtsTable the colomn [IDCat] must be link to colomn [ID] of CatTable - in PtsTable the colomn [IDFotog] must be link to colomn [ID] of FotTable How can I do this? How can I set the double's precision of the colomn in a table (for example colomn [X] in CatTable? And how can I set the table's primary key? If I create tables as seen before primary key is unset. Thanks a lot for answers -- remove AGR for reply
Technical Details
Message-ID:
<3ffd3f77@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,e3763118c208c643,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2004-01-08 03:39:39 PST Date: Thu, 08 Jan 2004 12:29:18 +0100 From: Pat <pat-rizioAGR@libero.it> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: it, en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.database.ado Subject: How to use ADOX to link tables in MS Access Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 62.98.120.217 Message-ID: <3ffd3f77@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1073561463 62.98.120.217 (8 Jan 2004 03:31:03 -0700) Lines: 47 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail