Page 1 of 1

Parameter binding problem

Posted: Thu 12 May 2005 08:40
by Hamid
I need to open one query in run time whit dynamic parameter binding, but it dosn't work and no record exist in result set .(similar code works whit BDE and some records in result set). furthermore similar query whit no parameters (static parameter binding in sql command) works in my code.
my query has one parameter whit String type.
please tell me your advise and expriments.

Posted: Thu 12 May 2005 09:15
by Alex
It's hard to understand exact cause of your problem. We need more detailed description i.e. complete sample to demonstrate it and script to create server objects. Please, send a message to our ODAC support e-mail address.

more detailes (Hamid)

Posted: Thu 12 May 2005 11:21
by hh
for example this scrips has no result set:

OraSelQ->Close();
OraSelQ->SQL->Clear();
OraSelQ->SQL->Add("SELECT f1,f2 FROM t1 where f3=:1");
OraSelQ->Params->Items[0]->DataType = ftString;
OraSelQ->Params->Items[0]->AsString = "ABC";
OraSelQ->Open(); ==> this dataset is empty

but this two scripts have some records in result set :

OraSelQ->Close();
OraSelQ->SQL->Clear();
OraSelQ->SQL->Add("SELECT f1,f2 FROM t1 where f3='ABC' ");
OraSelQ->Open(); ==> this dataset has some records

or this one:
OraSelQ->Close();
OraSelQ->SQL->Clear();
OraSelQ->SQL->Add("SELECT f1,f2 FROM t1 where f3 like :1 ");
OraSelQ->Params->Items[0]->DataType = ftString;
OraSelQ->Params->Items[0]->AsString = "ABC%";
OraSelQ->Open(); ==> this dataset has some records

all of this samples works whit BDE components and have some records.

Posted: Fri 13 May 2005 07:08
by Alex
I couldn't reproduce your problem, I have tested it on C++Builder 5 and 6, ODAC 5.50.1.18 against Scott.EMP table and always got satisfactory results, the test sample was

Code: Select all

// TOraQuery *OraSelQ;
OraSelQ->Close();
OraSelQ->SQL->Clear();
OraSelQ->SQL->Add("select mgr, empno from emp where ename=:1");
OraSelQ->Params->Items[0]->DataType = ftString;
OraSelQ->Params->Items[0]->AsString = "JONES";
OraSelQ->Open();
Please specify your exact ODAC version, IDE version, Oracle Client/Server version and send us small sample that demonstrates your problem with scripts to create server objects.