CrystalReport and VB.net

If you are a new to crystal report and don’t know why it is not listing your data off from your dataset, then here is the reason why: You have not done it!

Basically, after you have created your crystal report, what you need to do is the following:

Add CrystalDecisions references to your project and drag the ReportViewer control onto your form. The references may vary but typically include:

[code]
CrystalDecisions.CrystalReports.Engine
CrystalDecisions.Shared
CrystalDecisions.Windows.Forms
CrystalDecisions.ReportSource
[/code]

Then add something similar of this code to your Load event of the form, which sets the reportsource to your report and retrieves data from datasource.

And here is the code:

[code]

Dim rpt As New rpttuitionremission
Dim myConnection As PgSqlConnection
Dim myCommand As New PgSqlCommand
Dim myDA As New PgSqlDataAdapter
Dim myDS As New DataSet

Try
myConnection = New PgSqlConnection(My.Settings.ConnectionString)
myCommand.Connection = myConnection

myCommand.CommandText = “SELECT * FROM yourtable”

myCommand.CommandType = CommandType.Text
myDA.SelectCommand = myCommand

myDA.Fill(myDS, “ProcessDataTable”)
rpt.SetDataSource(myDS)
Me.CrystalReportViewer1.ReportSource = rpt
Catch ex As Exception

End Try

[/code]

And that is all, if you need help, just email me.

Sphere: Related Content

Uncategorized

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

I would want need information visual basic asp, and asp.net using crystal report

zioraj, let me know what you need… I might be able to help you out.

Leave a comment

(required)

(required)