MSSQL stored procedure ParamByName

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
martind1
Posts: 17
Joined: Mon 19 Oct 2009 05:15

MSSQL stored procedure ParamByName

Post by martind1 » Tue 12 Aug 2014 22:21

TUniStoredProcedure.ParamByName doesn't find any parameter when addressing
procedures with output parameter. FindParam yields nil.
However Params works fine.

Code: Select all

create procedure IS_WFRO_PERS_OK
  @WFRO_NR varchar(30),
  @BVOR_ID int,
  @PERS_ID int,
  @OK int output
as ...
This message appears when doubleclick on such a component in the form editor:
Image

Using UniDAC Version 5.3.10 for Delphi XE2 with MSSQL 2008
Edit: After downgrading to 4.5.10 all works

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: MSSQL stored procedure ParamByName

Post by azyk » Fri 15 Aug 2014 12:47

We failed to reproduce the issue, when the TUniStoredProcedure.ParamByName method does not find any parameters for the stored procedure containing the output parameter. Please try reproduce the problem on our UniDacDemo project - and let us know the results. The UniDacDemo project is in the folder "С:\Program Files\Devart\UniDAC for RAD Studio XE2\Demos\UniDacDemo\"

If the problem can't be reproduced on our demo, try to compose a small sample to demonstrate the problem and send it to andreyz*devart*com.

We reproduced and fixed the error, taking place when double-clicking the TUniStoredProcedure component, that is located on the project form. This fix will be included in the next UniDAC build.

rkaule
Posts: 3
Joined: Wed 22 Sep 2010 17:26

Re: MSSQL stored procedure ParamByName

Post by rkaule » Mon 18 Aug 2014 19:50

Hi,

Any ETA as to the update to fix this problem?

Thanks,
Bob

PavloP
Devart Team
Posts: 149
Joined: Fri 24 Jan 2014 12:33

Re: MSSQL stored procedure ParamByName

Post by PavloP » Wed 20 Aug 2014 09:24

We can send the night build, containing fix for the design-time editor issue. To receive it, please send your license number to support*devart*com.

martind1
Posts: 17
Joined: Mon 19 Oct 2009 05:15

Re: MSSQL stored procedure ParamByName

Post by martind1 » Fri 29 Aug 2014 19:41

the error with ParamByName occurs when the parameters are stored in the .dfm with @-prefixes.

Code: Select all

  object procIS_WFRO_PERS_OK: TUniStoredProc
    StoredProcName = 'dbo.IS_WFRO_PERS_OK'
    Connection = DlgLogon.Database1
    Left = 368
    Top = 480
    ParamData = <
      item
        DataType = ftInteger
        Name = 'Ergebnis'
        ParamType = ptResult
      end
      item
        DataType = ftString
        Name = '@WFRO_NR'
        ParamType = ptInput
      end
      item
        DataType = ftInteger
        Name = '@BVOR_ID'
        ParamType = ptInput
      end
      item
        DataType = ftInteger
        Name = '@PERS_ID'
        ParamType = ptInput
      end
      item
        DataType = ftInteger
        Name = '@OK'
        ParamType = ptOutput
      end>
    CommandStoredProcName = 'dbo.IS_WFRO_PERS_OK'
  end
Older versions of unidac handle these '@' without problem.
I think these names came from the migrated BDE projects (or from an very old unidac).

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: MSSQL stored procedure ParamByName

Post by azyk » Tue 02 Sep 2014 08:45

Thank you for the information. We have reproduced the problem and will investigate it.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: MSSQL stored procedure ParamByName

Post by azyk » Thu 04 Sep 2014 13:19

In SDAC, parameters for stored procedures are named so that they don't contain the @ leading symbol. UniDAC behavior for SQL Server for this case is implemented so that it doesn't differ from the one of SDAC. To solve the problem, please delete the @ leading symbol in the parameter names of the used TUniStoredProc components.

martind1
Posts: 17
Joined: Mon 19 Oct 2009 05:15

Re: MSSQL stored procedure ParamByName

Post by martind1 » Fri 05 Sep 2014 23:47

Your suggestion is accepted.
Thanks for treatment of the topic.
I wonder why this was possible in earlier versions.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: MSSQL stored procedure ParamByName

Post by azyk » Tue 09 Sep 2014 10:09

We will change this behavior for compatibility with SDAC.

Post Reply