🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Parameter not found error

#671
From: Borland Newsgroups
Date: Tue, 14 Feb 2006 21:40
29 lines
1987 bytes
 I have the following code in C++ builder 6:

 q->CommandText =  "INSERT INTO Locks (LockType, Expiration, Username, Data, 
ExclusiveLock) ";
 q->CommandText += "VALUES (:LockType, :Expiration, :Username, :Data, 
:ExclusiveLock)";
 q->Parameters->ParamByName("LockType")->Value = LockText[type];
 ...

when the third line is executed, I get an error saying that the parameter 
"LockType" does not exist. If, however, I combind the first two lines into a 
single line...

q->CommandText =  "INSERT INTO Locks (LockType, Expiration, Username, Data, 
ExclusiveLock) VALUES (:LockType, :Expiration, :Username, :Data, 
:ExclusiveLock)";

everything works fine. I have made sure CommandType = cmdText, and even 
called Parameters->ParseSQL. I still get the same error. Looking at the 
examples in the BCB6 documentation, I think I am doing what they do there, 
but there appears to be a problem using the '+=' operator with 
CommandText...

Any ideas how I can fix this without having to combine all my long SQL 
statements into long C++ lines?

Thanks,

John F. Lund
Technical Details
Message-ID: <43f24d3f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,1c73062edbea6d21,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Borland Newsgroups" <John@LundFamily.com>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Parameter not found error
Date: Tue, 14 Feb 2006 14:40:02 -0700
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 71.37.99.65
Message-ID: <43f24d3f$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1139952959 71.37.99.65 (14 Feb 2006 13:35:59 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail