hi,

i'm getting error of data source object is invalid when i try to load a transaction report from sql database. Error 4 Overload resolution failed because no accessible 'Fill' can be called with these arguments:
'Public Function Fill(startRecord As Integer, maxRecords As Integer, ParamArray dataTables() As System.Data.DataTable) As Integer': Value of type 'View_CreditBalance.DS1' cannot be converted to 'Integer'.
'Public Function Fill(dataSet As System.Data.DataSet, srcTable As String) As Integer': Value of type 'View_CreditBalance.DS1' cannot be converted to 'System.Data.DataSet'. C:\Documents and Settings\Administrator\Desktop\CreditBalance\CreditBalance\CreditBalance\Report.vb 30 9 View_CreditBalance

i have no idea why does it happen. Can anyone help me

Edited 6 Years Ago by swathys: n/a

hi,

i have change something in the code and now i'm getting error Value cannot be null. Parameter name: dataSet. What i'm missing actually. Please help me

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports CrystalDecisions
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared


Public Class Report

    
    Private Sub Report_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


        Dim myConnection As SqlConnection
        Dim MyCommand As New SqlCommand()
        Dim myDA As New SqlDataAdapter()
        ' Dim daAll As New DS1
        '        Dim ds As DataSet
        'With yhe following line
        Dim daAll As System.Data.DataSet


        'myConnection = New SqlConnection("server=" & server & ";uid=" & suid & ";pwd=" & spwd & ";database=" & sTransDatabase)
        myConnection = New SqlConnection("server=(remote); database=CreditLimit; Trusted_Connection=yes")

        MyCommand.Connection = myConnection

        If bSortBy Then
            If bSortByKioskID Then
                          Dim rpt As New kioskID

                             MyCommand.CommandText = "SELECT KioskID,TransactionDateTime, AgencyName, AccountNo, BillNo, BillAmount, ServiceCharge, TotalAmount, DealerCommission FROM CreditLimit.dbo.TransactionRecord WHERE Kiosk_ID = '" & kioskno & "' ORDER BY TransactionRecord.KioskID"

             
                MyCommand.CommandType = CommandType.Text
                myDA.SelectCommand = MyCommand
                myDA.Fill(daAll, "TransactionRecord")
                rpt.SetDataSource(daAll)
                rpt.SetParameterValue("kioskno", kioskno)
                CrystalReportViewer1.ShowCloseButton = True
                CrystalReportViewer1.ReportSource = rpt


            ElseIf bSortByTransDate Then
                Dim rpt As New sortbyDate

                'MyCommand.CommandText = "SELECT KioskID,TransactionDateTime, AgencyName, AccountNo, BillNo, BillAmount, ServiceCharge, TotalAmount, DealerCommission FROM ePay.dbo.BillTransaction WHERE trans_date >='" & DateFrm & "' AND trans_date <= '" & DateTo & "' ORDER BY BillTransaction.KioskID"
                MyCommand.CommandText = "SELECT KioskID,TransactionDate, AgencyName, AccountNo, BillNo, BillAmount, ServiceCharge, TotalAmount, DealerCommission FROM CreditLimit.dbo.TransactionRecord WHERE Kiosk_ID = '" & kioskno & "' ORDER BY TransactionRecord.KioskID"
                MsgBox(MyCommand.CommandText)

                MyCommand.CommandType = CommandType.Text
                myDA.SelectCommand = MyCommand

                myDA.Fill(daAll, "TransactionRecord")
                rpt.SetDataSource(daAll)

                rpt.SetParameterValue("sdate1", DateFrm.ToShortDateString())
                rpt.SetParameterValue("sdate2", DateTo.ToShortDateString())
                CrystalReportViewer1.ShowCloseButton = True
                CrystalReportViewer1.ReportSource = rpt

            End If

        End If

        myConnection.Close()

    End Sub
End Class

hi,

i have modify the code when i run the code
1) If bSortBy Then
it load the report but doesn't read the record inside it. the report just show the title without record
2) ElseIf bSortByTransDate Then
when i use the 2nd option report by date. its pop up error invalid index at rpt.SetParameterValue("sdate1", DateFrm.ToShortDateString())
rpt.SetParameterValue("sdate2", DateTo.ToShortDateString())

whats wrong with the code please help me !!!

Dim myConnection As SqlConnection
        Dim MyCommand As New SqlCommand()
        Dim ds As New System.Data.DataSet

        myConnection = GetConnect("REMOTE")
        myConnection.Open()

        If bSortBy Then
            If bSortByKioskID Then
                ' kioskno = "K0000-0002                                        "
                Dim rpt As New kioskID

                MyCommand.CommandText = "SELECT KioskID,TransactionDate, AgencyName, AccountNo, BillNo, BillAmount, ServiceCharge, TotalAmount, DealerCommission FROM CreditLimit.dbo.TransactionRecord WHERE KioskID = '" & kioskno & "' ORDER BY TransactionRecord.KioskID"

                Dim dscmd As New SqlDataAdapter(MyCommand.CommandText, myConnection)
                dscmd.Fill(ds, "TransactionRecord")

                Dim objRpt As New kioskID
                'rpt.SetParameterValue("kioskno", kioskno)
                objRpt.SetDataSource(ds)
                CrystalReportViewer1.ReportSource = objRpt
                CrystalReportViewer1.Refresh()


            ElseIf bSortByTransDate Then
                Dim rpt As New sortbyDate

                MyCommand.CommandText = "SELECT KioskID,TransactionDate, AgencyName, AccountNo, BillNo, BillAmount, ServiceCharge, TotalAmount, DealerCommission FROM CreditLimit.dbo.TransactionRecord WHERE KioskID = '" & kioskno & "' ORDER BY TransactionRecord.KioskID"

                Dim dscmd As New SqlDataAdapter(MyCommand.CommandText, myConnection)
                dscmd.Fill(ds, "TransactionRecord")

                Dim objRpt As New sortbyDate
                rpt.SetParameterValue("sdate1", DateFrm.ToShortDateString())
                rpt.SetParameterValue("sdate2", DateTo.ToShortDateString())
                CrystalReportViewer1.ShowCloseButton = True
                CrystalReportViewer1.ReportSource = objRpt
                'objRpt.SetDataSource(ds)
                'CrystalReportViewer1.ReportSource = objRpt
                CrystalReportViewer1.Refresh()


            End If

        End If

        myConnection.Close()

Edited 6 Years Ago by swathys: n/a

try this code it will work

If bSortBy Then      
      If bSortByKioskID Then              
  ' kioskno = "K0000-0002                                        "       
       Dim sql as string
            
sql = "SELECT KioskID,TransactionDate, AgencyName, AccountNo, BillNo, BillAmount, ServiceCharge, TotalAmount, DealerCommission FROM CreditLimit.dbo.TransactionRecord WHERE KioskID = '" & kioskno & "' ORDER BY TransactionRecord.KioskID"                 
Dim dscmd As New SqlDataAdapter(sql, myConnection)    //just pass the sql query to adpter
 dscmd.Fill(ds, "TransactionRecord")           
      Dim objRpt As New kioskID            
    'rpt.SetParameterValue("kioskno", kioskno)       
         objRpt.SetDataSource(ds)             
   CrystalReportViewer1.ReportSource = objRpt       
         CrystalReportViewer1.Refresh()

hi,

its still the same. gives error in a parameter part. do i need to do something there

This question has already been answered. Start a new discussion instead.