1
votes

I am creating a summary data report using Crystal Reports. I tried to use from and to date parameter in my query, but it is giving me the following error:

Failed to retrieve data from database.
Details: ADO Error Code: 0x80040e10
Source: Microsoft SQL server native client 11.0
Description: No value given for one or more parameters

My query which i am using is given below:

select X.ITEMCODE,X.[ITEM_DESCRIPTION], X.[OPENING_BALANCE],   X.[SALES], X.[TOTAL_REJECTS], 
 X.[REJECTION_DISEASES], X.[DOCDATE]

        from
        (  
        SELECT DISTINCT T0.ItemCode AS ITEMCODE, T0.ItemName AS [ITEM_DESCRIPTION],

        ISNULL((SELECT SUM(T1.OnHand) FROM OITW T1 WHERE  T1.WhsCode = 'FGS' AND 
        T1.ItemCode = T0.ItemCode),0) AS [OPENING_BALANCE],
        ISNULL((SELECT SUM(T1.[Quantity]) FROM INV1 T1 WHERE   T0.[ItemCode] = T1.[ItemCode]),0) AS [SALES] , 
        (SELECT top 1 T1.[DocDate] FROM INV1 T1 WHERE T1.DocDate BETWEEN {?FromDate} AND {?ToDate}  AND  T0.[ItemCode] = T1.[ItemCode]) AS [DOCDATE],

        ISNULL((SELECT SUM(cast(T1.[Quantity] as int))  FROM IGE1 T1 WHERE T1.DocDate BETWEEN {?FromDate} AND {?ToDate}  AND T0.[ItemCode] = T1.[ItemCode]),0) AS [TOTAL_REJECTS],
        Isnull((SELECT TOP 1 T1.[U_RejectionOthers] 
        FROM   ige1 T1 
        WHERE  T0.[itemcode] = T1.[itemcode]
        ), 0) AS [REJECTION_DISEASES]

        from OITM T0 where T0.[ItmsGrpCod] in ('104','121','122','123','124','125','126','127','129','130','134','135','136','139','140','141','142','143','144','145')
        ) X
1
do you make sure all parameters send to the query with values? - Lewis Hai
sometimes when get this error I need to use the Logoff Server and then LogOn Server features that are available under the Crystal Reports menu option. Somehow my machine loses the credentials to connect to the database and I need to re-enter. - Douglas Timms
@DouglasTimms whenever i try to click ok after pasting this query it is giving this error.server is logged in already. I tried this as well - Kirat
I dint get you what you are trying to say @LewisHai - Kirat
Have you created parameters before firing this query on database? - Siva

1 Answers

0
votes

I can't get you correctly, but i understand the problem check the following steps 1:At First check your query when passing the vale the query gets executed or not 2:Then check your crystal report parameters. i think you use the blank values for your input parameters.

3:if it check it means please uncheck that..