Article View: borland.public.cppbuilder.database.ado
Article #1962How to use ADOX to link tables in a MS Access database
From: Pat
Date: Wed, 07 Jan 2004 11:48
Date: Wed, 07 Jan 2004 11:48
46 lines
2710 bytes
2710 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:
<4mSKb.236525$e6.9369883@twister2.libero.it>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!nntp.infostrada.it!twister2.libero.it.POSTED!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,62a1a38776f07e50,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2004-01-07 03:48:17 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!nntp.infostrada.it!twister2.libero.it.POSTED!not-for-mail 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 a MS Access database Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 47 Message-ID: <4mSKb.236525$e6.9369883@twister2.libero.it> Date: Wed, 07 Jan 2004 11:48:16 GMT NNTP-Posting-Host: 62.98.120.206 X-Complaints-To: abuse@inwind.it X-Trace: twister2.libero.it 1073476096 62.98.120.206 (Wed, 07 Jan 2004 12:48:16 MET) NNTP-Posting-Date: Wed, 07 Jan 2004 12:48:16 MET Organization: [Infostrada]