Dim SqlCon As New SqlConnection(con)
Dim cmd As New SqlCommand
Dim da As New SqlDataAdapter
Dim ds As New DataSet
Dim dt As New DataTable
Dim strSQL As String
strSQL = "SELECT emp.empID,emp.name,emp.lastname,cr.remain FROM credit cr INNER JOIN employee emp ON cr.empID=emp.empID ORDER BY empID ASC"
With cmd
.Connection = SqlCon
.CommandText = strSQL
.CommandType = CommandType.Text
End With
da.SelectCommand = cmd
da.Fill(ds, "TableCredit")
dt = ds.Tables(0)
ds = Nothing
SqlCon.Close()
SqlCon = Nothing
Dim rpt As New ReportDocument()
rpt.Load(server.MapPath("~/Reports/ReportCR.rpt"))
rpt.SetDataSource(dt)
Me.CrystalReportViewer1.ReportSource = rpt
'Me.CrystalReportViewer1.RefreshReport()
Tag : .NET, Ms SQL Server 2008, Crystal Report, Web (ASP.NET), VB.NET