VB.NET and crystal report - Need help

Discussion in 'ASP .Net' started by Learner, Jan 12, 2006.

  1. Learner

    Learner Guest

    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
    ******************************************
     
    Learner, Jan 12, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Wallace
    Replies:
    0
    Views:
    1,061
    James Wallace
    Oct 17, 2003
  2. Learner
    Replies:
    1
    Views:
    1,138
    Richard Dudley
    Jan 11, 2006
  3. anshu
    Replies:
    0
    Views:
    493
    anshu
    Aug 31, 2006
  4. Ashish Mehndi
    Replies:
    0
    Views:
    1,189
    Ashish Mehndi
    Aug 2, 2004
  5. Comfort
    Replies:
    0
    Views:
    559
    Comfort
    Oct 18, 2004
Loading...

Share This Page