BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Parameter question

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (ADO)
View previous topic :: View next topic  
Author Message
Pieter
Guest





PostPosted: Mon Jul 11, 2005 4:09 pm    Post subject: Parameter question Reply with quote




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

Back to top
Viatcheslav V. Vassiliev
Guest





PostPosted: Mon Jul 11, 2005 7:44 pm    Post subject: Re: Parameter question Reply with quote



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 (AT) nomail (DOT) com> сообщил/сообщила в новостях следующее:
news:42d299b9$1 (AT) newsgroups (DOT) borland.com...
Quote:

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




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.