VB.NET and crystal report - Need help

L

Learner

Hi there,
I am just trying to populate crystal report with customers data from
Northwind database. The below is the code.

It doesn't return any error and i can see the report in the front but
the report is empty. It doesn't have the data in it. i am i missing
some thing here?

Please help thanks
-L

**********************************
code*********************************************************

Dim rpt As New CrystalReport1
Dim myConnection As SqlConnection
Dim MyCommand As New SqlCommand
Dim myDA As New SqlDataAdapter
Dim myDS As New Dataset1

Try

myConnection = New SqlConnection("Data
Source=localhost;Integrated Security=SSPI;" & _
"Initial
Catalog=northwind;")
MyCommand.Connection = myConnection
MyCommand.CommandText = "SELECT * FROM Customers"
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand

myDA.Fill(myDS, "Customers")
rpt.SetDataSource(myDS)
CrystalReportViewer1.ReportSource = rpt

Catch Excep As Exception
MessageBox.Show(Excep.Message, "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
**************************************** end of the code
******************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top