🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Index search method to use

#1928
From: Pat
Date: Wed, 21 Jan 2004 11:00
69 lines
3411 bytes
Hi Al,
I think you can use also a TADOQuery component just as follow:

TADOQuery->Close();
TADOQuery->SQL->Clear();
TADOQuery->SQL->Add("SELECT * FROM " + TableName + " WHERE parentID >= 10");
TADOQuery->Open();

Regards,
Pat



Alain M. Dube wrote:

> I've encountered a problem with ADO and Access:
> 
> My access database has five tables, each table as multiple indices.
> 
> I'm using a TADOConnection and a TADOTable to access the MS Access DB; code
> below used to setup the objects:
> 
> #define CONNECT_STRING_FMT     "Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=%s;User Id=admin;Password="
> 
>             // Create a DB Connection COM Object Instance
>             mpConnection = new TADOConnection(NULL);
>             mpConnection->ConnectOptions = coConnectUnspecified;
>             mpConnection->CursorLocation = clUseClient;
>             mpConnection->IsolationLevel = ilCursorStability;
>             mpConnection->LoginPrompt = false;
>             mpConnection->Mode = cmShareDenyNone;
>             strConnectionString = Format(CONNECT_STRING_FMT,
> OPENARRAY(TVarRec, (strMediaLibraryDBPath)));
>             mpConnection->ConnectionString = strConnectionString;
>             mpConnection->Connected = true;
> 
>             // Create a Table Object Instance for the Container Table
>             mpContainerTable = new TADOTable(NULL);
>             mpContainerTable->Active = false;
>             mpContainerTable->Connection = mpConnection;
>             mpContainerTable->CursorType = ctKeyset;
>             mpContainerTable->TableName  = TABLE_NAME_CONTAINER;
>             mpContainerTable->IndexName  = INDEX_NAME_PRIMARY;
>             mpContainerTable->Active = true;
> 
>             {  ... repeat for each addition table...  }
> 
> I intend on doing all of the normal database management stuff:  a)  add,
> modify and delete records, b) search tables using various indices, c)
> transaction bracketing, etc.  What method is recommended for doing
> index-based search using a relational operator?
> 
> example:  get record whose parentID >= 10
> 
> In DAO, the recordset.seek() allows a relational operator on one or more key
> values against the current index.  Is there an equivalent?
> 
> Thanks in advance for your help.
> 
> Regards;
> 
> Al Dube
> 
> 


-- 
remove AGR for reply
Technical Details
Message-ID: <400e5c27@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <400e1da8$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,cb3d0ba8006d975c
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2004-01-21 03:09:28 PST
Date: Wed, 21 Jan 2004 12:00:20 +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: Re: Index search method to use
References: <400e1da8$1@newsgroups.borland.com>
In-Reply-To: <400e1da8$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 62.98.144.208
Message-ID: <400e5c27@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1074682919 62.98.144.208 (21 Jan 2004 03:01:59 -0700)
Lines: 70
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail