A better way of passing parameters to a TADOStoredProc (Delphi)

后端 未结 4 895
隐瞒了意图╮
隐瞒了意图╮ 2021-01-02 11:56

I am needing to convert a large amount of SQL queries into stored procedures. I have some code that updates about 20 or 30 values at one time in one Delphi procedure. I can

4条回答
  •  猫巷女王i
    2021-01-02 12:44

    There's an accepted answer :-), but I want to point you to simpler and easier way to define and use the parameters with one line :

    stored_procedure.Parameters.CreateParameter('SSN',ftString,pdInput,30,edtSSN.text);
    

    It's simple and flexible, because you can define the input and output parameters with same line.

    and from Delphi help:

    function CreateParameter(const Name: WideString; DataType: TDataType;
        Direction: TParameterDirection; Size: Integer; 
        Value: OleVariant): TParameter;
    

提交回复
热议问题