another one...

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for Oracle in Delphi and C++Builder
Post Reply
Guest

another one...

Post by Guest » Fri 01 Jul 2005 00:26

Ok another one:
delphi 2005 oracle 8.1.7

One form, one sqlconnection, one sqlquery, two buttons

FIRST BUTTON:

begin
sqlQuery1.Close;
sqlQuery1.SQL.Clear;
sqllQuery1.SQL.Add('SELECT * FROM MYTABLE');
sqlQuery.Open;
end;

SECOND BUTTON:

begin
sqlQuery1.Close;
sqlQuery1.SQL.Clear;
sqllQuery1.SQL.Add('SELECT * FROM MYTABLE WHERE FIELD1 >= :PAR');
sqlQuery1.Params[0].DataType := ftBCD;
sqlQuery1.Params[0].ParamType := ptInput;
sqlQuery1.Params[0].Value := 200;
sqlQuery1.Open;
end;

1) press button1: OK

2) press button2: OK (data filtered correctly also)

3) press button1 again: BUM! ORA-01036 (message translated in my language, but in english is something like: "Name or number of variables not allowed")

I've tried setting coPrepared = False in afterconnect, but no success...
Seems related to params: if I change my SQL in button2 with another one without params everything works fine.

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Fri 01 Jul 2005 07:05

We cannot reproduce your problem with Delphi 2005 SP2 (VCL .Net or VCL Win32), DbxOda 2.50.4, Oracle 8.1.7. Please check that sqlQuery1.Params collection is empty before opening it in Button1Click.

Code: Select all

var sqlQuery1: TSQLQuery;

procedure TForm1.Button1Click(Sender: TObject);
begin
  sqlQuery1.Close;
  sqlQuery1.SQL.Clear;
  sqlQuery1.SQL.Add('SELECT * FROM EMP');
  sqlQuery1.Open;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  sqlQuery1.Close;
  sqlQuery1.SQL.Clear;
  sqlQuery1.SQL.Add('SELECT * FROM EMP WHERE EMPNO >= :PAR');
  sqlQuery1.Params[0].DataType := ftBCD;
  sqlQuery1.Params[0].ParamType := ptInput;
  sqlQuery1.Params[0].Value := 200;
  sqlQuery1.Open;
end;

Guest

delphi2005-related problem

Post by Guest » Fri 01 Jul 2005 09:03

with 2005 SP3 I have the problem.
if I recompile the same project with d7 works fine.

Guest

Post by Guest » Fri 01 Jul 2005 12:00

try to add to your code a datasetprovider linked to sqlquery and a clientdataset linked to datasetprovider, then open clientdataset.

another one: if you move data from provider to clientdataset using an OleVariant variable works fine. Probably is some borland bug, not your fault. Strange is that mysql is not affected.

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Fri 01 Jul 2005 12:56

Send us please small demo project to demonstrate the problem to DbxOda support address and include script to create server objects.

Post Reply