Click here to Skip to main content
15,905,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, ive been dealing with a kind of no error message my application is throwing after the setup has been installed on my machine. The application run fine and generate a report exactly the way i want it. The problem is that after compiling it as set up, it throws this message:

System.Runtime.InteropServices.COMException (0x80000000); 
No error. 
at 
CrystalDesisionsReportAppServer.Controllers.DatabaseControllerClass.ReplaceConnection(Object oldConnection, Object newConnection, Object parameterFields, Object crDBOptionUseDefault) 
at 
CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type) 
at  
CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet) 
at Presby_Soft.reportFrm.reportFrm_Load(Object sender, EventArgs e) 


This is my code:

VB
Private Sub reportFrm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If conn.State = ConnectionState.Closed Then
            conn.Open()
        End If

        Try
            Dim rpt As New CrystalReport1()
            Dim da As New SQLiteDataAdapter
            Dim ds As New presbydbDataSet


            'Dim cmd As New SQLiteCommand("SELECT personal_details.fn, training.training_level FROM personal_details INNER JOIN training ON personal_details.Staff_ID ='" + detailsFrm.Label13.Text + "'", conn)


            Dim cmd As New SQLiteCommand("SELECT * FROM personal_details WHERE personal_details.staff_ID='" + detailsFrm.Label13.Text + "'", conn)

            cmd.ExecuteNonQuery()
            da.SelectCommand = cmd
            da.Fill(ds, "personal_details")
            rpt.Subreports.Item("persoRpt").SetDataSource(ds)

            CrystalReportViewer1.ReportSource = rpt



        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try

        conn.Close()
    End Sub


Please tell me what im doing wrong. Im using vb.net on windows7. thanks for answering
Posted

1 solution

Well, it's a little difficult to tell since you didn't tell us what line was causing the errors. I would guess from the error message that it was rpt.Subreports.Item("persoRpt").SetDataSource(ds)


For one thing, you should really try to isolate your Try/Catch blocks more. Only put the items that you think could throw an error. For instance, none of this:
VB
Dim rpt As New CrystalReport1()
Dim da As New SQLiteDataAdapter
Dim ds As New presbydbDataSet

'Dim cmd As New SQLiteCommand("SELECT personal_details.fn, training.training_level FROM personal_details INNER JOIN training ON personal_details.Staff_ID ='" + detailsFrm.Label13.Text + "'", conn)

Dim cmd As New SQLiteCommand("SELECT * FROM personal_details WHERE personal_details.staff_ID='" + detailsFrm.Label13.Text + "'", conn)


should ever throw an error...unless you remove the references to them.

Put cmd.ExecuteNonQuery() in its own Try/Catch.
Put da.Fill(ds, "personal_details") in its own Try/Catch.
Put rpt.Subreports.Item("persoRpt").SetDataSource(ds) in its own Try/Catch.

You get the idea.

Anyway, are you sure that you're using the SetDataSource correctly and that it will take a DataSet? Everything I've seen requires that a DataTable be passed in to SetDataSource. If it does take a DataSource, can you verify that the Fill works correctly and that there is something in the DataSource?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900