Article View: borland.public.cppbuilder.database.ado
Article #672Re: Parameter not found error
From: Viatcheslav V. Vassiliev
Date: Wed, 15 Feb 2006 08:00
Date: Wed, 15 Feb 2006 08:00
47 lines
2805 bytes
2805 bytes
Combining into one AnsiString or WideString is much more effective than use
CommandText += (this one will set ADOCommand.CommandText when you add every
next line). In C++ Builder, there may be problems with += used with
properties.
//------------------------------------------
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)
"Borland Newsgroups" <John@LundFamily.com> �������/�������� � ��������
���������: news:43f24d3f$1@newsgroups.borland.com...
> 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:
<43f2deb8@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<43f24d3f$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,1c73062edbea6d21 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <43f24d3f$1@newsgroups.borland.com> Subject: Re: Parameter not found error Date: Wed, 15 Feb 2006 11:00:27 +0300 Lines: 49 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2670 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 85.93.138.132 Message-ID: <43f2deb8@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1139990200 85.93.138.132 (14 Feb 2006 23:56:40 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail