Board index » delphi » Assigning value to parameter in stored procedure

Assigning value to parameter in stored procedure

I am having trouble assigning a value to an input parameter of a stored
procedure in SQL Server 7, from Delphi 5
Here is my code...

    StProc := TADOStoredProc.Create(nil);
    with StProc  do
        begin
          ConnectionString := GetConnectionString('XXXX', 'XXXX','XXXXXXX');
          Parameters.CreateParameter('@RecNo', ftString, pdInput, 100, '');
          ProcedureName := 'GetDocumentDetails';
          Parameters[0].Value := strAccessNo;
          ExecProc;
        end;

It falls over on:  Parameters[0].Value := strAccessNo

Can anyone help please?

 

Re:Assigning value to parameter in stored procedure


When you assign stored proc name, it clears parameters.
First assign ProcedureName, then create params.

If you read the error message, you'd be able to figure this out by
yourself - it takes much more time to post a question and wait for answers
(if any), than read the error message and .... think a little ....
No offense, it's just a hint.
--
----------------------
Regards
Robert Cerny
Remove both qwe when replying
email: robert.qwe.ce...@neosys.xrs.qwe.si

No questions via email, unless explicitly invited.

Quote
Dan Dyson wrote in message <8hoa55$r...@bornews.borland.com>...
>I am having trouble assigning a value to an input parameter of a stored
>procedure in SQL Server 7, from Delphi 5
>Here is my code...

>    StProc := TADOStoredProc.Create(nil);
>    with StProc  do
>        begin
>          ConnectionString := GetConnectionString('XXXX',
'XXXX','XXXXXXX');
>          Parameters.CreateParameter('@RecNo', ftString, pdInput, 100, '');
>          ProcedureName := 'GetDocumentDetails';
>          Parameters[0].Value := strAccessNo;
>          ExecProc;
>        end;

>It falls over on:  Parameters[0].Value := strAccessNo

>Can anyone help please?

Other Threads