You are on page 1of 1

Changes required accordingly

1. Save Crystal Report Name: CrystalReport1
2. Save Table Name: Student
3. Change Data source OR mycon path and user password according to your own

Code to Populate the Report
Imports System
Imports System.Data
Imports System.Data.SqlClient

Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs)
Handles MyBase.Load

Dim rpt As New CrystalReport1
Dim myCon As SqlConnection
Dim myAdapter As SqlDataAdapter
Dim myDataset As New DataSet

myCon = New SqlConnection("Data Source=RAZA\SQLEXPRESS;Initial
Catalog=testdb;User ID=sa;Password=raza")

myAdapter = New SqlDataAdapter("SELECT * FROM Student", myCon)
myAdapter.Fill(myDataset, "Student")
CrystalReportViewer1.ReportSource = rpt

End Sub

End Class