Crystal Report using sql query

Crystal report does not display correct result when using sql query

Page 1 of 1

0 Replies - 1956 Views - Last Post: 02 June 2010 - 09:08 AM Rate Topic: -----

#1 Ro5hi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 30-May 10

Crystal Report using sql query

Posted 02 June 2010 - 09:08 AM

:unsure:
I dont know y this happens...i try a lot of times but....anyways, the problem is that,
the crystal report does not show the actual result when an sql query is being used to extract data, even from a single table...while it runs correcty in MS Access where i have my database....
I am using the same query but, all in vein...
:helpsmilie:

here's the code:

Dim ds As New DataSet
        Dim conn As OleDb.OleDbConnection = New OleDb.OleDbConnection("Provider=microsoft.jet.oledb.4.0 ; data source=C:\pos\pos.mdb")
        Dim da As OleDb.OleDbDataAdapter
        Dim dt As New DataTable

        Dim sql As String = "SELECT * from Sales"
        'Dim sql As String = "SELECT Sum(S_Ttl), S_Date FROM Sales WHERE S_Date Between #5/30/2010# And #6/1/2010# GROUP BY S_Date"
        da = New OleDb.OleDbDataAdapter(sql, conn)
        Try

            da.Fill(ds, "Sales")
        Catch err As Exception
            MessageBox.Show(err.ToString, " Path", MessageBoxButtons.OKCancel, MessageBoxIcon.Error)
        End Try
        dt = ds.Tables("Sales")
        Dim cr As New CrystalReport1
        cr.SetDataSource(ds.Tables(0))
        CrystalReportViewer1.ReportSource = cr


Is This A Good Question/Topic? 0
  • +

Page 1 of 1