我正在使用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