🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How do I submit an SQL statement to an Access database using code?

#2177
From: Ted Byers
Date: Fri, 31 Oct 2003 20:22
25 lines
2039 bytes
> var conn = new ActiveXObject("ADODB.Connection");
> conn.Open(connStr);
> conn.Execute("CREATE TABLE JUNK (NDX COUNTER(1, 1) NOT NULL CONSTRAINT
> PRIMKEY PRIMARY KEY, " +
>  "NAMEVALUE VARCHAR(60) WITH COMPRESSION NOT NULL)");
> conn.Execute("CREATE TABLE TABLE2 (NDX INTEGER NOT NULL CONSTRAINT PRIMKEY
> PRIMARY KEY, " +
>  "COL2 VARCHAR(20) WITH COMPRESSION, CONSTRAINT FORKEY FOREIGN KEY (NDX)
> REFERENCES JUNK(NDX) " +
>  "ON UPDATE CASCADE ON DELETE SET NULL)");
> conn = null;
> //----------------------------

Thanks loads.  I translated this, and as expected it works, but when I
examined the resulting database using MS Access, I saw one problem.  In the
table TABLE2, NDX is shown as being indexed, as expected, but without
duplicates.  This is inconsistent with what is shown in the relationships
diagram, where the relationship is shown as being one (in table JUNK) to
many (in table TABLE2).  How would I change the SQL you show to change NDX
in TABLE2 to being indexed but with duplicates being allowed?

Cheers,

Ted
Technical Details
Message-ID: <3fa2c520$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3fa29d35$1@newsgroups.borland.com> <3fa2b26b@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,d26ef4716ff1429f
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-10-31 12:39:41 PST
From: "Ted Byers" <r.ted.byers@sympatico.ca>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3fa29d35$1@newsgroups.borland.com> <3fa2b26b@newsgroups.borland.com>
Subject: Re: How do I submit an SQL statement to an Access database using code?
Date: Fri, 31 Oct 2003 15:22:20 -0500
Lines: 27
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: 65.95.126.104
Message-ID: <3fa2c520$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1067631904 65.95.126.104 (31 Oct 2003 12:25:04 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail