System.Runtime.InteropServices.COMException(0x80000000);没错 [英] System.Runtime.InteropServices.COMException (0x80000000); No error.

查看:87
本文介绍了System.Runtime.InteropServices.COMException(0x80000000);没错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在安装设置到我的机器上之后,一直在处理我的应用程序未抛出的错误消息.该应用程序运行良好,并完全按照我想要的方式生成报告.问题在于,按照设置对其进行编译后,它将引发以下消息:

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:

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



请告诉我我做错了什么.我在Windows7上使用vb.net.感谢您回答



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

推荐答案

好吧,这很难说,因为您没有告诉我们是哪一行导致了错误.我会从错误消息中猜测它是rpt.Subreports.Item("persoRpt").SetDataSource(ds)


一方面,您应该真正尝试更多地隔离尝试/捕获"块.仅放入您认为可能会引发错误的项目.例如,这些都不是:
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:
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.Fill(ds, "personal_details")放入其自己的尝试/捕获"中.
rpt.Subreports.Item("persoRpt").SetDataSource(ds)放入其自己的尝试/捕获"中.

你明白了.

无论如何,您确定您使用的是SetDataSource正确并且将使用DataSet吗?我所见过的一切都要求将DataTable传递给SetDataSource.如果确实使用了数据源,您可以验证填充是否正常工作并且数据源中是否有东西吗?



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?


这篇关于System.Runtime.InteropServices.COMException(0x80000000);没错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆