Thread View: borland.public.cppbuilder.database.ado
2 messages
2 total messages
Started by Pieter
Mon, 11 Jul 2005 16:09
Parameter question
Author: Pieter
Date: Mon, 11 Jul 2005 16:09
Date: Mon, 11 Jul 2005 16:09
19 lines
1243 bytes
1243 bytes
Hi,
I use the following code:
String SQL = "PARAMETERS name Text(255);"
SQL += "SELECT ID FROM tblClient WHERE clientName = name";
qry->SQL->Clear();
qry->SQL->Add(SQL);
qry->Parameters->ParamByName("name") = "Test";
qry->ExecSQL();
When I execute this code I get the following error:
Parameter 'name' not found
What I am doing wrong?
Thanks in advance
Re: Parameter question
Author: Viatcheslav V. Vassiliev
Date: Mon, 11 Jul 2005 19:44
Date: Mon, 11 Jul 2005 19:44
35 lines
2026 bytes
2026 bytes
ParamByName recognizes parameters in form :paramName - select ID from
tblClient where clientName = :name. Try qry->Parameters->Refresh() after
assigning SQL, you may want to set ParamCheck = false if you do not use
:paramName notation. BTW, your syntax is for MS Jet (MS Access) only.
//------------------------------------------
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)
"Pieter" <pieter@nomail.com> �������/�������� � �������� ���������:
news:42d299b9$1@newsgroups.borland.com...
>
> Hi,
>
> I use the following code:
>
> String SQL = "PARAMETERS name Text(255);"
> SQL += "SELECT ID FROM tblClient WHERE clientName = name";
> qry->SQL->Clear();
> qry->SQL->Add(SQL);
> qry->Parameters->ParamByName("name") = "Test";
>
> qry->ExecSQL();
>
> When I execute this code I get the following error:
> Parameter 'name' not found
>
> What I am doing wrong?
>
> Thanks in advance
>
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