Use the crystalreportviewer1 control to display the Report on the Asp.net webpage. If you call the data table method when creating a report, the call is successful. However, if you use the stored procedure to obtain data in a report, the following error occurs:
The table 'rptopencheck; 1' is not found '. File G: \ temp \ fo-opencheck {6d191f06-decf-4a25-88fc-8553e3d435aa}. rpt error: the table cannot be found.
Error: the object reference is not set to the instance of the object.
The table 'rptopencheck; 1 'could not be found. Error in file G: \ temp \ fo-opencheck {6d191f06-decf-4a25-88fc-8553e3d435aa}. rpt: The table cocould not be found.
The connection cannot be opened. The connection cannot be opened. G: \ temp \ fo-opencheck {4e60249e-fc16-4f3d-a610-138fc3297171}. rpt
Vs2005 environment, crsytal reports 11.5
The Code is as follows:
Dim crtablelogoninfos as new tablelogoninfos
Dim crtablelogoninfo as new tablelogoninfo
Dim crconnectioninfo as new connectioninfo
Dim crparameterfields as parameterfields
Dim crparameterfield as parameterfield
Dim crparametervalues as parametervalues
Dim crparameterdefvalues as parametervalues
Dim crparametervalue as parametervalue
Dim crparameterdiscretevalue as parameterdiscretevalue
Dim crtables as tables
Dim crtable as table
Dim reportname as string
Dim printto as string 'P printer V window
Dim reportpath as string
Dim username as string
Dim password as string
Dim servername as string
Dim databasename as string
Dim crreportdocument as new reportdocument
Private sub page_load (byval sender as system. Object, byval e as system. eventargs) handles mybase. Load, me. Load
Dim strparam as string = request ("p ")
'Get user request parameters
If right (strparam, 1) = "~ "Then
Strparam = mid (strparam, 1, Len (strparam)-1)
End if
'Parameter conversion to array
S = Split (strparam ,"~ ")
'That is, this sentence is not added, so the above error message will appear. Only when the report calls the stored procedure to retrieve data will an error occur. It took me a few days to finally solve the problem.
Crtable. Location = crtable. Name
Next
'Set the properties displayed by the control.
With crystalreportviewer1
'Assign a value to the report using the parameters requested by the user. If the report requires parameters, the report parameter value starts from the third element.
Crparameterdiscretevalue = nothing
Crparameterdiscretevalue = new parameterdiscretevalue
If I> (J-2) then
Select case crparameterfield. parametervaluekind
Case parametervaluekind. booleanparameter
Crparameterdiscretevalue. value = false
Case parametervaluekind. currencyparameter
Crparameterdiscretevalue. value = nothing
Case parametervaluekind. dateparameter
Crparameterdiscretevalue. value = system. datetime. Now
Case parametervaluekind. datetimeparameter
Crparameterdiscretevalue. value = system. datetime. Now
Case parametervaluekind. numberparameter
Crparameterdiscretevalue. value = nothing
Case parametervaluekind. stringparameter
Crparameterdiscretevalue. value = ""
Case parametervaluekind. timeparameter
Crparameterdiscretevalue. value = system. datetime. Now
End select
Crparametervalues. Add (crparameterdiscretevalue)
Else
Select case crparameterfield. parametervaluekind
Case parametervaluekind. booleanparameter
Crparameterdiscretevalue. value = IIF (S (I + 2) = "0", false, true)
Case parametervaluekind. currencyparameter
Crparameterdiscretevalue. value = IIF (TRIM (S (I + 2) & "") = "", nothing, S (I + 2 ))
Case parametervaluekind. dateparameter
Crparameterdiscretevalue. value = IIF (TRIM (S (I + 2) & "") = "", nothing, S (I + 2 ))
Case parametervaluekind. datetimeparameter
Crparameterdiscretevalue. value = IIF (TRIM (S (I + 2) & "") = "", nothing, S (I + 2 ))
Case parametervaluekind. numberparameter
Crparameterdiscretevalue. value = IIF (TRIM (S (I + 2) & "") = "", nothing, S (I + 2 ))
Case parametervaluekind. stringparameter
Crparameterdiscretevalue. value = IIF (TRIM (S (I + 2) & "") = "", "", S (I + 2 ))
Case parametervaluekind. timeparameter
Crparameterdiscretevalue. value = IIF (TRIM (S (I + 2) & "") = "", nothing, S (I + 2 ))
End select
Crparametervalues. Add (crparameterdiscretevalue)
End if
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.