Dear Friends,
Please help me urgent.
I have tried to create the code in vb.net 2003 in crystal reports 10. I had my code as follows:-
Con.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
"C:\Program Files\inventory.MDB;" & _
"Persist Security Info=False;" & _
"Jet OLEDB:Database Password = tz_2006"
Con.Open()
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RS = New ADODB.Recordset
Dim strReportName As String
CHECK_STRING = "SELECT * FROM CITY_CITIES"
RS.Open(CHECK_STRING, Con, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
strReportName = "CITIES"
Dim strReportPath As String = "C:\Program Files\REPORTS" & "\" & strReportName & ".rpt"
'Check file exists
If Not IO.File.Exists(strReportPath) Then
Throw (New Exception("Unable to locate report file:" & vbCrLf & strReportPath))
End If
Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
rptDocument.Load(strReportPath)
rptDocument.SetDataSource(RS)
AxCRViewer1.EnableGroupTree = False
AxCRViewer1.ReportSource = rptDocument
AxCRViewer1.ViewReport()
End Sub
The Error I am getting is the 3rd line from below (i.e. AxCRViewer1.ReportSource = rptDocument) which the Error states that "an unhanded exception of type 'system.invalidcastexception' occured in axinterop.crviewerlib.dll" and "Additional information: No such interface supported"
Thanks.Open the report and Do verify Database
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment