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.
another one...
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;
delphi2005-related problem
with 2005 SP3 I have the problem.
if I recompile the same project with d7 works fine.
if I recompile the same project with d7 works fine.
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.
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.