🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: ADO SQL Parameters

#480
From: Viatcheslav V. Vassiliev
Date: Mon, 29 May 2006 21:46
51 lines
2458 bytes
I am not sure that you can pass 5, 4, 3 as one parameter. Your solution may 
look for string '5,4,3' but not for 3 numbers.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)


"Stephane Baillargeon" <stephane_baillargeon@sympatico.ca> ???????/???????? 
? ???????? ?????????: news:447b60f5$1@newsgroups.borland.com...
>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: <447b6ba0@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-mail
References: <447b50f9@newsgroups.borland.com> <447b60f5$1@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
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <447b50f9@newsgroups.borland.com> <447b60f5$1@newsgroups.borland.com>
Subject: Re: ADO SQL Parameters
Date: Tue, 30 May 2006 01:46:04 +0400
Lines: 53
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
X-RFC2646: Format=Flowed; Response
X-Antivirus: avast! (VPS 0622-1, 29.05.2006), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: 85.93.138.132
Message-ID: <447b6ba0@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1148939168 85.93.138.132 (29 May 2006 14:46:08 -0700)
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