General discussion

  • Creator
    Topic
  • #2153496

    Problem in ReportViewer using remote mode

    Locked

    by ashok ·

    Hi friends,

    I am using reports in my application. In reportviewer i am using local report in my code.Its working well. But for print icon display is needed in my application.So i am using server report. But errors occurred in the code.

    The Error is ” datasource is not a member of Microsoft.Reporting.WebForms.ServerReport”. What can i do? I can’t run the application using serverreport.
    For ur’s reference i put the code using local report

    Page.Title = “Reports Based On Company”
    dsGetValue = New DataSet
    objReport = New clsReport
    ReportViewer1.ProcessingMode = ProcessingMode.Local
    ReportViewer1.LocalReport.DataSources.Clear()
    Dim report As LocalReport = ReportViewer1.LocalReport
    dsGetValue = New DataSet

    If paramCompanyName = “All” Then
    ‘Temp DataTable to Concatenate the Address fields
    dtTempTimeSheet = New DataTable
    ‘Temp DataSet to Concatenate the Address fields
    dsgetTempSheet = New DataSet
    dtTempTimeSheet.Clear()
    dsgetTempSheet.DataSetName = “PmsDataSet”
    ‘ Add the new table
    dtTempTimeSheet = dsgetTempSheet.Tables.Add(“DataTable3”)
    ‘ Define the columns
    With dtTempTimeSheet
    .Columns.Add(“strCompanyName”, System.Type.GetType(“System.String”))
    .Columns.Add(“strRelationshipType”, System.Type.GetType(“System.String”))
    .Columns.Add(“strAddress1”, System.Type.GetType(“System.String”))
    .Columns.Add(“strContactNo”, System.Type.GetType(“System.String”))
    .Columns.Add(“strWebsite”, System.Type.GetType(“System.String”))
    End With

    dsGetValue = objReport.getDetailedReportForCompany(paramstrRelationshipType, paramCompanyName)

    For intloop = 0 To dsGetValue.Tables(0).Rows.Count – 1
    dbrow = dtTempTimeSheet.NewRow
    With dbrow
    .Item(“strCompanyName”) = dsGetValue.Tables(0).Rows(intloop)(0)
    .Item(“strRelationshipType”) = dsGetValue.Tables(0).Rows(intloop)(9)
    .Item(“strAddress1”) = dsGetValue.Tables(0).Rows(intloop)(4) + “,” + dsGetValue.Tables(0).Rows(intloop)(10)
    .Item(“strContactNo”) = dsGetValue.Tables(0).Rows(intloop)(6)
    .Item(“strWebsite”) = dsGetValue.Tables(0).Rows(intloop)(2)
    ‘Add New Row
    dtTempTimeSheet.Rows.Add(dbrow)
    End With
    Next

    End If

    ‘This Case Works If The Selected Company Name Is All
    If paramCompanyName = “All” Then

    Select Case dsgetTempSheet.Tables(0).Rows.Count
    Case Is > CInt(0)
    report.ReportPath = “ReportsNewUI/CompRelType.rdlc”
    Case Else
    report.ReportPath = “ReportsNewUI/ReportWithError.rdlc”
    End Select
    Try
    Dim strDatasource As New ReportDataSource()
    strDatasource.Name = “PmsDataSet_DataTable3”
    strDatasource.Value = dsgetTempSheet.Tables(“DataTable3”)
    report.DataSources.Add(strDatasource)
    Catch ex As Exception

    End Try

    ‘This Case Works If The Selected Company Name Is All
    ElseIf paramCompanyName <> “All” And paramstrRelationshipType = “All” Then
    dsGetValue = objReport.getDetailedReportForCompany(paramstrRelationshipType, paramCompanyName)
    Select Case dsGetValue.Tables(0).Rows.Count
    Case Is > CInt(0)
    ‘report.ReportPath = “ReportsNewUI/detailedReportForCompanyDetails.rdlc”
    report.ReportPath = “ReportsNewUI/ReportWithCompanyInformation.rdlc”
    Case Else
    report.ReportPath = “ReportsNewUI/ReportWithError.rdlc”
    End Select
    Try
    Dim strDatasource As New ReportDataSource()
    strDatasource.Name = “PmsDataSet_DataTable3”
    strDatasource.Value = dsGetValue.Tables(“DataTable3”)
    report.DataSources.Add(strDatasource)
    Catch ex As Exception

    End Try
    ElseIf paramCompanyName <> “All” And paramstrRelationshipType <> “All” Then
    dsGetValue = objReport.getDetailedReportForCompany(paramstrRelationshipType, paramCompanyName)
    Select Case dsGetValue.Tables(0).Rows.Count
    Case Is > CInt(0)
    ‘report.ReportPath = “ReportsNewUI/detailedReportForCompanyDetails.rdlc”
    report.ReportPath = “ReportsNewUI/ReportWithCompanyInformation.rdlc”
    Case Else
    report.ReportPath = “ReportsNewUI/ReportWithError.rdlc”
    End Select
    Try
    Dim strDatasource As New ReportDataSource()
    strDatasource.Name = “PmsDataSet_DataTable3”
    strDatasource.Value = dsGetValue.Tables(“DataTable3”)
    report.DataSources.Add(strDatasource)
    ‘Send Paramteres To Report File
    ‘Dim StatusParameter As New ReportParameter()
    ‘StatusParameter.Name = “strCompanyName”
    ‘StatusParameter.Values.Add(“Company Name” & ” ” & paramCompanyName)
    ‘Dim parameter() As ReportParameter = {StatusParameter}
    ‘report.SetParameters(parameter)

    Catch ex As Exception

    End Try
    End If

    Finally
    dsGetValue = Nothing
    objReport = Nothing

    I hope ur’s reply soon.

    Thanks
    🙂

All Comments