0

我正在使用 MS Access .mdb 文件在 VB.NET 2008 中设计基于 Windows 的应用程序。以下是我的代码;我面临的问题是报告没有表格。我没有类型化的数据集。我直接使用以下查询填充报告:

Imports System.Data Imports System.Data.OleDb 
Public Class  frmInvoiceReport
        Public da As OleDbDataAdapter
        Public ds As DataSet
        Public con As OleDbConnection
        Public cmd As OleDbCommand
        Public dt As DataTable
        Public sBuilder As OleDbCommandBuilder
        Public sqlq, constr, table As String
        Private Sub frmInvoiceReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            constr = ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & My.Application.Info.DirectoryPath &
    "\Shri_Swami_Samartha_Classes.mdb")
            con = New OleDbConnection(constr)
            con.Open()
            sqlq = "Select * from InvoiceRptQuery where SerialCode =1"
            If con.State = ConnectionState.Open Then con.Close()
            con.Open()
            da = New OleDbDataAdapter(sqlq, con)
            ds = New DataSet
            da.Fill(ds)
            con.Close()
            Dim obj As New Mrptv1
            obj.SetDataSource(ds.Tables("InvoiceRptQuery"))
            CrystalReportViewer1.ReportSource = obj
            CrystalReportViewer1.Refresh()
        End Sub
 End Class
4

0 回答 0