"Could not load file or assembly 'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified."
Imports CrystalDecisions.CrystalReports.Engine
Imports MySql.Data
Imports MySql.Data.MySqlClient
Imports System.IO
Imports System.Text
Public Class frm_Receipt
Private Sub frm_Receipt_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim objConn As New MySqlConnection
Dim objCmd As New MySqlCommand
Dim dtAdapter As New MySqlDataAdapter
Dim ds As New DataSet
Dim strConnString, strSQL As String
strConnString = "Server=localhost; Database=bookrental; Uid=JN; Pwd=12345;charset=utf8"
Dim dtMain As DataTable
strSQL = "SELECT * FROM receipt ORDER BY Rec_ID ASC "
objConn.ConnectionString = strConnString
With objCmd
.Connection = objConn
.CommandText = strSQL
.CommandType = CommandType.Text
End With
dtAdapter.SelectCommand = objCmd
dtAdapter.Fill(ds)
dtMain = ds.Tables(0)
Dim dtRent As DataTable
strSQL = "SELECT rent.Rent_ID,rent.Mem_ID,rent.Mem_FName,rent.Mem_LName,rent.Book_ID,rent.Book_NameTH,rent.dateEnd FROM rent ORDER BY Rent_ID ASC "
objConn.ConnectionString = strConnString
With objCmd
.Connection = objConn
.CommandText = strSQL
.CommandType = CommandType.Text
End With
dtAdapter.SelectCommand = objCmd
dtAdapter.Fill(ds)
dtRent = ds.Tables(0)
Dim dtBook As DataTable
strSQL = "SELECT book.Book_Rent FROM book ORDER BY Book_ID ASC "
objConn.ConnectionString = strConnString
With objCmd
.Connection = objConn
.CommandText = strSQL
.CommandType = CommandType.Text
End With
dtAdapter.SelectCommand = objCmd
dtAdapter.Fill(ds)
dtBook = ds.Tables(0)
Dim rpt As New ReportDocument()
rpt.Load("F:\Projects\Project IT (ปัญหาพิเศษ)\ตัวโปรแกรม\BookRental\BookRental\cry_RecReport.rpt")
'** for Main Report **'
rpt.SetDataSource(dtMain)
'** for Rent Sub Report **'
rpt.Subreports("Rent_Sub_Report").Database.Tables(0).SetDataSource(dtRent)
'** for Book Sub Report **'
rpt.Subreports("Book_Sub_Report").Database.Tables(0).SetDataSource(dtBook)
Me.CrystalReportViewer1.ReportSource = rpt
dtAdapter = Nothing
objConn.Close()
objConn = Nothing
End Sub
End Class