Home > Back-end >  Delphi a potential problem: call MySql stored procedures, behind the open cursor statement, and assi
Delphi a potential problem: call MySql stored procedures, behind the open cursor statement, and assi

Time:04-18

Elphi7 invoke MySql stored procedures, under the open the cursor in the process of storage, give and assign a value to the stored procedure, can not get out the parameter values, as shown below:
Stored procedure:
Create procedure MyProc (in inpara varchar (20), the out outpara varchar (100))
The begin
.
Declare cur1 cursor for the select id from table1;
The open cur1;
The set outpara='ABC';//as long as in the open cur1; Behind the statement, won't get outpara values, are shown as empty,
.
end;

Delphi program calling code:
.
SStr:='a';
With adostoreproc1. The parameters do
The begin
Createparameter (' INPARA 'ftstring, pdinput, 100, sStr);
Createparameter (' OUTPARA 'ftstring, pdoutput, 4000, null);
end;
Adostoreproc1. Execproc;
Sout:=adostoreproc1. The parameters. Parambyname (' OUTPARA). The value;//interrupt point here, return parameter value is empty, sout nature is empty,
.

CodePudding user response:

You should have added again, you are in Navicat Premium in debugging the parameter values can be extracted,

CodePudding user response:

Yes, yes, in Navicat Premium in debugging the parameter values can be extracted

CodePudding user response:

Estimate is a big flaw in Delphi!!!!!!!!!! Accidentally discovered by me!!!!!!

CodePudding user response:

Written standards stored procedure:
Create procedure MyProc (inpara varchar (20), outpara varchar (100))
As
The begin
//...
Select the 'ABC' into: outpara;
End
  • Related