none
A data source instance has not been supplied for the data source 'DataSet1'. what for occurred this error? RRS feed

  • General discussion

  • code

    Imports Microsoft.VisualBasic
    Imports System.Data
    Imports System.Data.SqlClient
    Imports System.Configuration
    Imports System.Web.UI.WebControls
    Imports Microsoft.Reporting.WebForms
    Imports Microsoft.Reporting.WebForms.ScriptManagerNotFoundException
    Imports System.Linq
    Imports System.Web.UI.ScriptManager
    Imports System.Web
    Imports System.IO



    Partial Class _Default
        Inherits System.Web.UI.Page


        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Try

                Dim sp As New Class1
                Dim dt As New DataTable
                Dim drd As DataRow
                Dim accid As Integer = 0
                Dim i As String = Convert.ToString(accid)
                dt = Class1.getprintAccountingReport(Where:=accid)
                Dim balancelist As New DataTable

                balancelist.Columns.Add("BALANCE_CREDIT")
                balancelist.Columns.Add("BALANCE_DEBIT")
                balancelist.Columns.Add("TOTAL_AMOUNT_CREDIT")
                balancelist.Columns.Add("TOTAL_AMOUNT_DEBIT")
                balancelist.Columns.Add("ACCOUNT_NAME")

                For Each drd In dt.Rows



                    balancelist.Rows.Add(drd(5).ToString(), drd(4).ToString(), drd(3).ToString(), drd(2).ToString(), drd(1).ToString())

                Next

                ReportViewer1.LocalReport.DataSources.Clear()
                Dim rpt As ReportDataSource = New ReportDataSource("DataSet1_SPPrintAccountingReports", balancelist)
                ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("DataSet1_SPPrintAccountingReports", balancelist))

                ReportViewer1.LocalReport.DataSources.Add(rpt)
                ReportViewer1.LocalReport.Refresh()
                ReportViewer1.DataBind()

           Catch ex As Exception
                MsgBox(ex.Message)
            End Try

        End Sub
    End Class

     aspx

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

    <%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        
        </div>
        <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" 
            Font-Size="8pt" InteractiveDeviceInfos="(Collection)" 
            style="top: 171px; left: 258px; ; width: 1285px; height: 444px" 
            WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
            <LocalReport ReportPath="Report.rdlc">
              
            </LocalReport>
        </rsweb:ReportViewer>

        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" 
            TypeName="DataSet1TableAdapters.SPPrintAccountingReportsTableAdapter">
            <SelectParameters>
                <asp:Parameter DefaultValue="0" Name="vWHERE" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        </form>
    </body>
    </html>

    Monday, May 20, 2013 2:47 PM