A data source instance has not been supplied for the data source“Product_Detail” in Microsoft reporting service

后端 未结 10 1353
孤独总比滥情好
孤独总比滥情好 2021-02-07 03:19

I`m trying to display record in a Report. Data is in the Dataset. but it is not binind to them. When forms load it shows it report layout. But when i click on the button it show

相关标签:
10条回答
  • 2021-02-07 03:51

    There was two dataSet created in my rdlc file by default(don't know the reason). Opened RDLC file through notepad and deleted the datasource which was not needed. The values were getting assigned two times to two different dataset. Hope this may help you.

    0 讨论(0)
  • 2021-02-07 03:53
    Imports Microsoft.Reporting.WebForms
    
    Partial Class Rpt_reports
    Inherits System.Web.UI.Page
    
      Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Dim ds As New Custamer
            'da.Fill(ds.Tables("custamer")
            Dim path As String = Server.MapPath("customerinfo.rdlc")
    
            ReportViewer1.LocalReport.DataSources.Clear()
            ReportViewer1.LocalReport.ReportPath = path
            ReportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WebForms.ReportDataSource("Rpt_reports", ds.Tables("Custamer")))
            ReportViewer1.LocalReport.Refresh()
        End If
      End Sub
    
      'Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    
      'End Sub
    
    End Class
    
    0 讨论(0)
  • 2021-02-07 03:54
        Dim rptDataSource As ReportDataSource
        Try
            With Me.ReportViewer1.LocalReport
                ReportViewer1.LocalReport.ReportPath = Application.StartupPath & "\RTFLS\Report1.rdlc"
                '.DataSources.Clear()
            End With
            Dim ds As New POAS.CustomersTotalPayment 
            Dim da As New POAS.CustomersTotalPaymentTableAdapters.PAYMENTSTATUSTableAdapter
    
            da.Fill(ds.PAYMENTSTATUS)
    
            rptDataSource = New ReportDataSource("CustomersTotalPayment", ds.Tables("PAYMENTSTATUS"))
            Me.ReportViewer1.LocalReport.DataSources.Add(rptDataSource)
    
            Me.ReportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout)
        Catch ex As Exception
            MessageBox.Show(ex.Message, My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    
    
        Me.ReportViewer1.RefreshReport()
    
    0 讨论(0)
  • 2021-02-07 03:54

    if you add another table to the xsd form after adding the report to the report viewer you might get this error.

    1. delete to report viewer and add it again
    2. set the report to the report viewer
    3. now go to the Load event of the form (that includes the report viewer and add the Fill for new dataset.

      private void rptForm_Load(object sender, EventArgs e) {
        this.vwrpt_TableAdapter1.Fill(this.DataSet1.vwDataset);
      }
      
    0 讨论(0)
  • 2021-02-07 03:55

    I just had this issue with VS 16.4.6 and the latest report designer extension 15.3.1.

    For me it was caused by giving the data set a slightly different name to the set I'd chosen from the drop down. It took me ages to figure out what was wrong. A hunch suggested it might be an issue. So I renamed the data set to match the source data entity and the error went away.

    But why offer the user the chance to call the data set something else and then not test that this actually works?

    The report viewer extension is still really poor quality.

    0 讨论(0)
  • 2021-02-07 03:57

    "ProductsDataSet" is the name of the DataSource you are giving it. Your Error is saying "A data source instance has not been supplied for the data source“Product_Detail” in Microsoft reporting service"

    I'm assuming you're assigning it the wrong name.

    Try,

    ReportDataSource rds = new ReportDataSource("Product_Detail", ds.Tables[0]);
    

    If you do have a datasource in the report called "ProductsDataSet" then you probably have 2, in which you'd wanna delete the one you aren't using or assign it a datasource as well.

    0 讨论(0)
提交回复
热议问题