Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Windows.Forms
Imports CrystalDecisions.ReportSource
Imports System.Data.OleDb
Public Class frmreport
Private Sub frmreport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
On Error GoTo ErrHandler
Dim strConnection As String = "Provider=SQLOLEDB;Data Source=192.168.1.232,1433;Initial Catalog=db_comsystem;User Id=sa;Password=1234;"
Dim Connection As New OleDbConnection(strConnection)
Dim strSQLOle As String = "SELECT * From tbcom_hd where id_device ='" & txtid_device.Text & "'"
Dim DA As New OleDbDataAdapter(strSQLOle, Connection)
Dim DS As New DataSet
DA.Fill(DS, "Report")
Dim strReportPath As String = "C:\Report\Report1.rpt"
Dim cr As New ReportDocument
cr.Load(strReportPath)
cr.SetDataSource(DS.Tables("Report"))
CrystalReportViewer1.ReportSource = cr
Exit Sub
ErrHandler:
Me.Close()
End Sub