开发者

VCL SQL [Query parameters error]

开发者 https://www.devze.com 2022-12-17 13:36 出处:网络
C++Builder ADOQuery SQLServer Continue of This questions line using this select with procedure : SELECT C.Hint,

C++Builder ADOQuery SQLServer

Continue of This questions line

using this select with procedure :

    SELECT
    C.Hint,
    CAST(CASE WHEN T2.ID_Param IS NULL THEN 1 ELSE 0 END as bit) AS Visi
FROM
    CfgListParIzm C
    LEFT JOIN
    (
    SELECT
        T.ID_Param
    FROM
        TbUserParam T
    WHERE
        T.ID_User = @ID_User
    ) T2 On T2.ID_Param = C.ID_ListParIzm
WHERE
    C.ID_ListGroupParIzm = @ID_ListGroupParIzm

Code :

AQ4->Close();
AQ4->Parameters->Items[1]->Value=(int)TS->Tabs->Objects[NewTab];
AQ4->Open();

Error :

List index of bounds (1)

But I can see this error only on run program. Test query->grid activation works norma开发者_开发技巧l (with manually setup properties)

also if I do

            AQ4->Close();
//        AQ4->Parameters->Items[1]->Value=(int)TS->Tabs->Objects[NewTab];
          AQ4->Open();

error :

AQ4: Field 'Visi' not found

AQ4 SQL :

FlowClientHardQ  :ID_User, :ID_ListGroupParIzm

I also tough about DBGrid&Checkbox compability (Source) but as my field is normal bit I think that's not trouble, I made a mistake somewhere else...


Not sure about C++ builder, but in Delphi VCL, input parameters shall be marked with : and not with @.

First, put the query at design time in a query component and inspect the parameters property. If there's no parameters defined, try changing the @ for :

Now, you are making more than one question here... so, let's go step by step.

0

精彩评论

暂无评论...
验证码 换一张
取 消