Article View: borland.public.cppbuilder.database.ado
Article #479Re: ADO SQL Parameters
From: Stephane Baillargeon
Date: Mon, 29 May 2006 21:00
Date: Mon, 29 May 2006 21:00
37 lines
1786 bytes
1786 bytes
I found it... WHERE Field1 IN (':List')
Stephane Baillargeon wrote:
> I'm trying to add a string as a parameter in a SQL query statement like
> this:
>
> ConnectionString is already taken care of and not shown here.
>
> TADOQuery *padoQry = new TADOQuery( NULL );
> AnsiString strList = "(5,4,3)";
>
> padoQry->SQL->Clear();
> padoQry->SQL->LoadFromFile( SQLFILE ); // (e.g.: "sqlfile.sql")
>
> padoQry->Parameters->Clear();
> padoQry->Parameters->AddParameter();
> padoQry->Parameters->Items[0]->Value = strList;
>
> padoQry->Open();
> // Error --> 'In operator without () in query expression...
>
>
> SQL FILE
>
> SELECT Field1, Field2
> FROM Table1
> WHERE Field1 IN :List
>
>
> I've tried this too without success
>
> SELECT Field1, Field2
> FROM Table1
> WHERE Field1 IN ( :List ) // :List == "5,4,3"
>
>
> Is there something I'm doing wrong?
Technical Details
Message-ID:
<447b60f5$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<447b50f9@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,b6fd364fa095c787 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 29 May 2006 17:00:08 -0400 From: Stephane Baillargeon <stephane_baillargeon@sympatico.ca> User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: ADO SQL Parameters References: <447b50f9@newsgroups.borland.com> In-Reply-To: <447b50f9@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.68.240.184 Message-ID: <447b60f5$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1148936437 67.68.240.184 (29 May 2006 14:00:37 -0700) Lines: 37 Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail