Thread View: borland.public.cppbuilder.database.ado
2 messages
2 total messages
Started by Borland Newsgroups
Tue, 14 Feb 2006 21:40
Parameter not found error
Author: Borland Newsgroups
Date: Tue, 14 Feb 2006 21:40
Date: Tue, 14 Feb 2006 21:40
29 lines
1987 bytes
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
Re: Parameter not found error
Author: 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
>
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads