Article View: borland.public.cppbuilder.database.ado
Article #478ADO SQL Parameters
From: Stephane Baillargeon
Date: Mon, 29 May 2006 19:51
Date: Mon, 29 May 2006 19:51
34 lines
1543 bytes
1543 bytes
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:
<447b50f9@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10698b,b6fd364fa095c787,start X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 29 May 2006 15:51:56 -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: ADO SQL Parameters Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.68.240.184 Message-ID: <447b50f9@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1148932345 67.68.240.184 (29 May 2006 12:52:25 -0700) Lines: 34 Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail