来自Access数据库问题的报告呈现 [英] Rendering of report from access database problem

查看:53
本文介绍了来自Access数据库问题的报告呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我正在将Microsoft reportviewer与ms Access数据库一起使用.实际上是从Mysql数据库中获取数据并将其存储在Access中,然后在reportviewer中进行查看.

问题是只有 1种的报告可以正常工作,当我尝试运行第二种类型的报告(具有不同的查询)时,它会显示正在生成报告" ...

当我关闭我的应用程序并首先运行第二种类型的报告时,它运行良好,但是在我运行第一类报告时关闭了它,它显示... 正在生成报告" ... .


谁能解释...

我的代码是-2按钮点击事件:-

Hello, I''m using microsoft reportviewer with ms access database.Actually fetching data from Mysql database and storing it inside Access, then viewing that in reportviewer.

The problem is that only 1 kind of report is working properly, when i try to run 2nd kind of report(with different query), it shows "Report is being generated"...

When i close my application and first run the 2nd type of report, it runs fine but after closing it when I run 1st kind of report , it shows..."Report is being generated"....


Can anyone explain...

My code is - 2 Button click event:-

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Try
            Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\mwsm.mdb;Jet OLEDB:Database Password=")
            Dim adap As New OleDbDataAdapter()
            Dim cmd = New OleDbCommand()
            que = "delete from purchase_supply_manager"
            con.Open()
            cmd = New OleDbCommand(que, con)
            cmd.ExecuteNonQuery()
            con.Close()
            If RadioButton1.Checked = True Then
                mon = Month(DateTimePicker1.Value)
                yr = Year(DateTimePicker1.Value)
                idat = DateSerial(yr, mon, 1)
                fdat = DateSerial(yr, mon, 31)
            ElseIf RadioButton2.Checked = True Then
                idat = DateTimePicker2.Value
                fdat = DateTimePicker3.Value
            End If
            If idat >= fdat Then
                MsgBox("Initial Date should be less than Final Date.", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Generate Member''s Report")
                Exit Sub
            End If
            If ComboBox3.Text = "" Or ComboBox4.Text = "" Then
                MsgBox("Select a brand,model from list.", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Generate Member''s Report")
                Exit Sub
            Else
                query_brand = ComboBox3.Text
                query_model = ComboBox4.Text
            End If
            que = "select * from purchase_supply_manager where date between ''" + idat.ToString("yyyy-MM-dd") + "'' and ''" + fdat.ToString("yyyy-MM-dd") + "'' and (brand=''" + query_brand + "'' and model=''" + query_model + "'') order by date"
            gc.access1(que)
            If gc.err = False Then
                If gc.rec.Tables(0).Rows.Count > 0 Then
                    myds.Clear()
                    myds = gc.rec.Copy
                    For i As Double = 0 To myds.Tables(0).Rows.Count - 1
                        invo = myds.Tables(0).Rows(i).Item("invoice_no")
                        dat = myds.Tables(0).Rows(i).Item("date")
                        brand = myds.Tables(0).Rows(i).Item("brand")
                        model = myds.Tables(0).Rows(i).Item("model")
                        qnt = myds.Tables(0).Rows(i).Item("quantity")
                        transport = myds.Tables(0).Rows(i).Item("transport_amount")
                        amount = myds.Tables(0).Rows(i).Item("product_amount")
                        discount = myds.Tables(0).Rows(i).Item("discount")
                        misc_charge = myds.Tables(0).Rows(i).Item("misc_charge")
                        sName = myds.Tables(0).Rows(i).Item("supplier_name")
                        que = "insert into purchase_supply_manager values(''" + invo + "'',''" + sName + "'',''" + dat.ToString("dd-MM-yyyy") + "'',''" + brand + "'',''" + model + "''," + qnt.ToString + "," + amount.ToString + "," + discount.ToString + "," + transport.ToString + "," + misc_charge.ToString + ")"
                        con.Open()
                        cmd = New OleDbCommand(que, con)
                        cmd.ExecuteNonQuery()
                        con.Close()
                    Next
                    report_purchase.Show()
                    report_purchase.MdiParent = MDIParent1
                    Me.Hide()
                Else
                    MsgBox("No Data Available.", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "Generate Member''s Report")
                End If
            End If
        Catch er As Exception
            MsgBox(er.ToString())
        End Try
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Try
            Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\mwsm.mdb;Jet OLEDB:Database Password=")
            Dim adap As New OleDbDataAdapter()
            Dim cmd = New OleDbCommand()
            que = "delete from purchase_supply_manager"
            con.Open()
            cmd = New OleDbCommand(que, con)
            cmd.ExecuteNonQuery()
            con.Close()
            If RadioButton1.Checked = True Then
                mon = Month(DateTimePicker1.Value)
                yr = Year(DateTimePicker1.Value)
                idat = DateSerial(yr, mon, 1)
                fdat = DateSerial(yr, mon, 31)
            ElseIf RadioButton2.Checked = True Then
                idat = DateTimePicker2.Value
                fdat = DateTimePicker3.Value
            End If
            If idat >= fdat Then
                MsgBox("Initial Date should be less than Final Date.", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Generate Member''s Report")
                Exit Sub
            End If
            If ComboBox2.Text = "" Then
                MsgBox("Select a supplier from list.", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Generate Member''s Report")
                Exit Sub
            Else
                sName = ComboBox2.Text
            End If
            que = "select * from purchase_supply_manager where date between ''" + idat.ToString("yyyy-MM-dd") + "'' and ''" + fdat.ToString("yyyy-MM-dd") + "'' and supplier_name=''" + sName + "'' order by date"
            gc.access1(que)
            If gc.err = False Then
                If gc.rec.Tables(0).Rows.Count > 0 Then
                    myds.Clear()
                    myds = gc.rec.Copy
                    For i As Double = 0 To myds.Tables(0).Rows.Count - 1
                        invo = myds.Tables(0).Rows(i).Item("invoice_no")
                        dat = myds.Tables(0).Rows(i).Item("date")
                        brand = myds.Tables(0).Rows(i).Item("brand")
                        model = myds.Tables(0).Rows(i).Item("model")
                        qnt = myds.Tables(0).Rows(i).Item("quantity")
                        transport = myds.Tables(0).Rows(i).Item("transport_amount")
                        amount = myds.Tables(0).Rows(i).Item("product_amount")
                        discount = myds.Tables(0).Rows(i).Item("discount")
                        misc_charge = myds.Tables(0).Rows(i).Item("misc_charge")
                        sName = myds.Tables(0).Rows(i).Item("supplier_name")
                        que = "insert into purchase_supply_manager values(''" + invo + "'',''" + sName + "'',''" + dat.ToString("dd-MM-yyyy") + "'',''" + brand + "'',''" + model + "''," + qnt.ToString + "," + amount.ToString + "," + discount.ToString + "," + transport.ToString + "," + misc_charge.ToString + ")"
                        con.Open()
                        cmd = New OleDbCommand(que, con)
                        cmd.ExecuteNonQuery()
                        con.Close()
                    Next
                    report_purchase.Show()
                    report_purchase.MdiParent = MDIParent1
                    Me.Hide()
                Else
                    MsgBox("No Data Available.", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "Generate Member''s Report")
                End If
            End If
        Catch er As Exception
            MsgBox(er.ToString())
        End Try
    End Sub

推荐答案

查看这些修复链接

无法显示Reportviewer正在生成报告"报告-VB 2005程序 [
See these fix links

Report is being generated - but never does! After Visual Studio sp1 install[^]
Reportviewer "report is being generated" can''t display report - VB 2005 program[^]


这篇关于来自Access数据库问题的报告呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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