Imports CrystalDecisions.CrystalReports.Engine
Public Class Report
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
Dim rpt As New ReportDocument()
Dim directory As String = My.Application.Info.DirectoryPath
rpt.Load("D:\1.55\การพัฒนาระบบสารสนเทศทางการศึกษา\testOriginalCrystalReport\testOriginal\CrystalReport1.rpt")
rpt.SetParameterValue("find", Me.search.Text)
Me.CrystalReportViewer1.ReportSource = rpt
Me.CrystalReportViewer1.Refresh()
End Sub
End Class
Imports CrystalDecisions.CrystalReports.Engine
Imports System.Data.SqlClient
Public Class frmReport
Private Sub btnReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReport.Click
Dim objConn As New SqlConnection
Dim objCmd As New SqlCommand
Dim dtAdapter As New SqlDataAdapter
Dim ds As New DataSet
Dim dt As DataTable
Dim strConnString, strSQL As String
strConnString = "Server=localhost;UID=sa;PASSWORD=;database=mydatabase;Max Pool Size=400;Connect Timeout=600;"
strSQL = "SELECT * FROM audit WHERE CustomerID = '" & Me.txtCustomerID.Text & "' "
objConn.ConnectionString = strConnString
With objCmd
.Connection = objConn
.CommandText = strSQL
.CommandType = CommandType.Text
End With
dtAdapter.SelectCommand = objCmd
dtAdapter.Fill(ds, "myDataTable")
dt = ds.Tables(0)
dtAdapter = Nothing
objConn.Close()
objConn = Nothing
Dim rpt As New ReportDocument()
Dim directory As String = My.Application.Info.DirectoryPath
'rpt.Load(directory & "\myCrystalReport1.rpt")
rpt.Load("C:\DemoCrystalReport2\DemoCrystalReport2\myCrystalReport1.rpt")
rpt.SetDataSource(dt)
Me.CrystalReportViewer1.ReportSource = rpt
Me.CrystalReportViewer1.Refresh()
End Sub
End Class
Imports CrystalDecisions.CrystalReports.Engine
Imports System.Data.SqlClient
Public Class Report
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
Dim objConn As New SqlConnection
Dim objCmd As New SqlCommand
Dim dtAdapter As New SqlDataAdapter
Dim ds As New DataSet
Dim dt As DataTable
Dim strConnString, strSQL As String
strConnString = "DSN=dbTestOdbc;UID=;PWD=;"
strSQL = "SELECT * FROM dbTest WHERE idStu = '" & Me.search.Text & "' "
Dim rpt As New ReportDocument()
Dim directory As String = My.Application.Info.DirectoryPath
'rpt.Load(directory & "\myCrystalReport1.rpt")
rpt.Load("D:\1.55\การพัฒนาระบบสารสนเทศทางการศึกษา\testOriginalDataSetCrystalReport\testOriginal\CrystalReport3.rpt")
rpt.SetDataSource(dt)
Me.CrystalReportViewer1.ReportSource = rpt
Me.CrystalReportViewer1.Refresh()
End Sub
End Class