Article View: borland.public.cppbuilder.database.ado
Article #1844Re: Index search method to use
From: Viatcheslav V. Vassiliev
Date: Thu, 22 Jan 2004 16:51
Date: Thu, 22 Jan 2004 16:51
225 lines
9466 bytes
9466 bytes
Your create components at runtime:
> mpConnection = new TADOConnection(NULL);
May somewhere the name for component is assigned and you need to add:
mpConnection->Name = "MyConnection";
This will prevent you from having multiple components with the same name.
According error you have problems with component name (this may be field
name, fielddef, indexdef etc.). Your error is raised from
TNamedItem.SetDisplayName in Db.pas. Try to find what causes this error -
which component (field, fielddef, indexdef) could be named
"ContainerByParent" and why this name may conflict whit other components.
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi + ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Alain M. Dube" <adube@cadencesoftware.com> �������/�������� � ��������
���������: news:400fd9d1$1@newsgroups.borland.com...
> Hi Vassiliev;
>
> Thanks for the info.
>
> You said below: "May be you need explicitely set name to connection and
> every table components that you create." I'm not sure what you are
telling
> me to do. Could you elaborate on this, please?
>
> Thanks again.
>
> Regards;
>
> Al Dube
>
> "Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
> news:400fcfe0$1@newsgroups.borland.com...
> > This method works.
> >
> > void __fastcall TForm1::Button1Click(TObject *Sender)
> > {
> > ADOConnection1->Connected = true;
> > ADOTable1->Connection = ADOConnection1;
> > ADOTable1->CursorLocation = clUseServer;
> > ADOTable1->TableDirect = true;
> > ADOTable1->TableName = "country";
> > ADOTable1->IndexName = "PrimaryKey";
> > ADOTable1->Active = true;
> >
> > ADOTable1->Seek(WideString("Cuba"), soAfterEQ);
> > }
> >
> >
> > The error you get ("A component named 'ContainerByParent' already
> exists.")
> > is raised from TNamedItem.SetDisplayName function and says that
component
> > with name 'ContainerByParent' exists. May be you need explicitely set
name
> > to connection and every table components that you create.
> >
> > //------------------------------------------
> > Regards,
> > Vassiliev V. V.
> > http://www.managed-vcl.com - using .Net objects in Delphi + ADO.Net
> > http://www.oledbdirect.com - The fastest way to access MS SQL Server,
> > MS Jet (Access) and Interbase (through OLEDB)
> >
> > "Alain M. Dube" <adube@cadencesoftware.com> �������/�������� � ��������
> > ���������: news:400e95ed$1@newsgroups.borland.com...
> > > As you can see from the sample code I included in my first post, there
> is
> > no
> > > IndexDefs or IndexField code, only IndexName = INDEX_NAME_PRIMARY.
The
> > > EDatabaseError occurs after the ->Active = true statement executes.
> > >
> > > Regards;
> > >
> > > Al
> > >
> > > "Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
> > > news:400e9347$1@newsgroups.borland.com...
> > > > Index is available only on server-side cursor. Do not add IndexDefs
or
> > > > IndexFields, just set IndexName property.
> > > >
> > > > //------------------------------------------
> > > > Regards,
> > > > Vassiliev V. V.
> > > > http://www.managed-vcl.com - using .Net objects in Delphi + ADO.Net
> > > > http://www.oledbdirect.com - The fastest way to access MS SQL
Server,
> > > > MS Jet (Access) and Interbase (through OLEDB)
> > > >
> > > > "Alain M. Dube" <adube@cadencesoftware.com> �������/�������� �
> ��������
> > > > ���������: news:400e87ea$1@newsgroups.borland.com...
> > > > > Thanks for the info.
> > > > >
> > > > > When opening the TADOTable object after having set the
> > > > > Connection->CursorLocation = clUseServer, an EDatabaseError is
> > generated
> > > > > stating "A component named 'ContainerByParent' already exists."
The
> > > > > 'ContainerByParent' component is an index within the just opened
> > table.
> > > > If
> > > > > I use the clUseClient CursorLocation option, the Table Open
> succeeds,
> > > but
> > > > > Seeks fail.
> > > > >
> > > > > Any thoughts?
> > > > >
> > > > > Regards;
> > > > >
> > > > > Al Dube
> > > > >
> > > > >
> > > > > "Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in
> message
> > > > > news:400e20a7$1@newsgroups.borland.com...
> > > > > > With indeces you should use Seek() method. This requires
> > > CursorLocation
> > > > =
> > > > > > clUseServer and TableDirect = True.
> > > > > >
> > > > > > //------------------------------------------
> > > > > > Regards,
> > > > > > Vassiliev V. V.
> > > > > > http://www.managed-vcl.com - using .Net objects in Delphi +
> ADO.Net
> > > > > > http://www.oledbdirect.com - The fastest way to access MS SQL
> > Server,
> > > > > > MS Jet (Access) and Interbase (through OLEDB)
> > > > > >
> > > > > > "Alain M. Dube" <adube@cadencesoftware.com> �������/�������� �
> > > ��������
> > > > > > ���������: news:400e1da8$1@newsgroups.borland.com...
> > > > > > > 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
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Technical Details
Message-ID:
<400fff8f@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-09!supernews.com!pln-w!lotsanews.com!newsfeed.kabelfoon.nl!195.129.110.21.MISMATCH!bnewsfeed00.bru.ops.eu.uu.net!bnewsinpeer00.bru.ops.eu.uu.net!emea.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<400e1da8$1@newsgroups.borland.com> <400e20a7$1@newsgroups.borland.com> <400e87ea$1@newsgroups.borland.com> <400e9347$1@newsgroups.borland.com> <400e95ed$1@newsgroups.borland.com> <400fcfe0$1@newsgroups.borland.com> <400fd9d1$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10698b,cb3d0ba8006d975c X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2004-01-22 09:03:24 PST From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <400e1da8$1@newsgroups.borland.com> <400e20a7$1@newsgroups.borland.com> <400e87ea$1@newsgroups.borland.com> <400e9347$1@newsgroups.borland.com> <400e95ed$1@newsgroups.borland.com> <400fcfe0$1@newsgroups.borland.com> <400fd9d1$1@newsgroups.borland.com> Subject: Re: Index search method to use Date: Thu, 22 Jan 2004 19:51:27 +0300 Lines: 227 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: <400fff8f@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1074790287 213.234.218.42 (22 Jan 2004 08:51:27 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-09!supernews.com!pln-w!lotsanews.com!newsfeed.kabelfoon.nl!195.129.110.21.MISMATCH!bnewsfeed00.bru.ops.eu.uu.net!bnewsinpeer00.bru.ops.eu.uu.net!emea.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail