🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#2179
From: Viatcheslav V. Vassiliev
Date: Sat, 01 Nov 2003 07:07
76 lines
3612 bytes
> What exactly is the purpose of statements like:
> > cat = null;
> > conn = null;

Releasing interface. You may set Variant to Unassigned or Null.

> AnsiString Name("carrot"), col2(something else);
>
> What would be the SQL statement to place the values held by these two
> variables into the two tables in the database, while ensuring that the
value
> "carrot" is not duplicated in the table called JUNK?

Execute 2 insert statements. To ensure that value in Name column is unique,
add unique key to your table.

> Is there also a "ADODB.RecordSet"?  If so, how does one determine if it is
> empty, and how does one get the values for a given field using it when it
is
> not empty, and how does one iterate through it's records?

Yes, it exists. You need it to examine resultset returned by SQL SELECT
query or table contents. If I am not wrong, recordset is empty when both BOF
and EOF are true. If not, execute MoveFirst() and see whether EOF is true.
You get field with recordet.Fields[i].Value or
recordset.Fields["fieldName"].Value. Iterate with MoveFirst() and
MoveNext().

//------------------------------------------
Regards,
Viatcheslav V. Vassiliev
http://www.managed-vcl.com
http://www.oledbdirect.com




"Ted Byers" <r.ted.byers@sympatico.ca> �������/�������� � ��������
���������: news:3fa2c14e$1@newsgroups.borland.com...
> Thanks,
>
> This is greatly appreciated.
>
> What exactly is the purpose of statements like:
> > cat = null;
> > conn = null;
>
> I assume they're equivalent to:
> // assuming Variant cat,comm;
> // & assuming cat and conn are initialized as in our example code
> cat = null;
> conn = null;
>
> Do you have an example of the SQL required to update a pair of tables
> related to each other through an autoincremented index field like the two
> shown in your example?  For example, suppose I have the following
> (deliberately using variable names matching the coresponding fields in the
> two tables):
>
> AnsiString Name("carrot"), col2(something else);
>
> What would be the SQL statement to place the values held by these two
> variables into the two tables in the database, while ensuring that the
value
> "carrot" is not duplicated in the table called JUNK?
>
> Is there also a "ADODB.RecordSet"?  If so, how does one determine if it is
> empty, and how does one get the values for a given field using it when it
is
> not empty, and how does one iterate through it's records?
>
> Thanks again,
>
> Ted
>
>
Technical Details
Message-ID: <3fa37ceb@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> <3fa2c14e$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,d26ef4716ff1429f
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-11-01 01:39:23 PST
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3fa29d35$1@newsgroups.borland.com> <3fa2b26b@newsgroups.borland.com> <3fa2c14e$1@newsgroups.borland.com>
Subject: Re: How do I submit an SQL statement to an Access database using code?
Date: Sat, 1 Nov 2003 10:07:30 +0300
Lines: 78
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: 213.234.218.42
Message-ID: <3fa37ceb@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1067678955 213.234.218.42 (1 Nov 2003 01:29:15 -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