Help getting started

edited 2:33PM in FastReport .NET
In the Visual Web Developer, I can create and run a report using the smart tag as long as it does not include any data (text labels only). I can also run a report with data if it is created originally outside of the VWD environment and references the data directly using a fixed path and connection string. However when using data from a datasource defined within the webpage IE SQLDATASOURCE1, it will not run and throws an error that says "Object reference not set to an instance of an object. ". It does not say which object its referring to but I assume it means the sqldatasource. What am I missing? The sqldatasource does in fact work OK with other controls on the form. I have tried it with both of the techniques outlined as "in a web form" and "in the FRX file" on page 27 of the programmers guide.

Thanks

Comments

  • edited 2:33PM
    Hello,

    Here is what I did and it works:
    - add SqlDataSource on a web page, configure it;
    - add WebReport component
    - click smart tag and select our data source;
    - click "Design Report";
    - create simple list report;
    - close the designer;
    - save all changes in a project;
    - run it and see the prepared report.

    If you have a simple demo that demonstrates the problem, please send it to tz@fast-report.com.
  • edited 2:33PM
    AlexTZ wrote: »
    Hello,

    Here is what I did and it works:
    - add SqlDataSource on a web page, configure it;
    - add WebReport component
    - click smart tag and select our data source;
    - click "Design Report";
    - create simple list report;
    - close the designer;
    - save all changes in a project;
    - run it and see the prepared report.

    If you have a simple demo that demonstrates the problem, please send it to tz@fast-report.com.
    Well, thanks for the reply. That is pretty much just what I did. Here is my markup.
    <!--
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConnectionString="<%$ ConnectionStrings:maillist %>"
    ProviderName="<%$ ConnectionStrings:maillist.ProviderName %>"
    SelectCommand="SELECT list_id, name, owner FROM list_definitions ORDER BY name">
    </asp:SqlDataSource>


    <cc1:WebReport ID="WebReport1"
    runat="server"
    ReportDataSources="SqlDataSource1"
    ReportFile="~/App_Data/testreportinside.frx"
    />
    -->

    And here is the report.

    <?xml version="1.0" encoding="utf-8"?>
    <Report ScriptLanguage="Vb" ReportInfo.Created="05/29/2009 13:05:41" ReportInfo.Modified="06/01/2009 10:33:41" ReportInfo.CreatorVersion="1.1.1.0">
    <scriptText>Imports System
    Imports System.Collections
    Imports System.Collections.Generic
    Imports System.ComponentModel
    Imports System.Windows.Forms
    Imports System.Drawing
    Imports Microsoft.VisualBasic
    Imports FastReport
    Imports FastReport.Data
    Imports FastReport.Dialog
    Imports FastReport.Table
    Imports FastReport.Barcode
    Imports FastReport.Utils

    Namespace FastReport
    Public Class ReportScript

    End Class
    End Namespace
    </ScriptText>
    <Dictionary>
    <ViewDataSource Name="SqlDataSource1" ReferenceName="SqlDataSource1" Enabled="true">
    <Column Name="list_id" DataType="System.Int32"/>
    <Column Name="name" DataType="System.String"/>
    <Column Name="owner" DataType="System.String"/>
    </ViewDataSource>
    </Dictionary>
    <ReportPage Name="Page1">
    <ReportTitleBand Name="ReportTitle1" Width="718.2" Height="37.8"/>
    <PageHeaderBand Name="PageHeader1" Top="41.8" Width="718.2" Height="28.35">
    <TextObject Name="Text2" Left="56.7" Width="94.5" Height="18.9" Text="list_id"/>
    <TextObject Name="Text4" Left="189" Width="94.5" Height="18.9" Text="name"/>
    <TextObject Name="Text6" Left="500.85" Width="94.5" Height="18.9" Text="owner"/>
    </PageHeaderBand>
    <DataBand Name="Data1" Top="74.15" Width="718.2" Height="75.6" DataSource="SqlDataSource1">
    <TextObject Name="Text1" Left="56.7" Top="18.9" Width="94.5" Height="18.9" Text="[SqlDataSource1.list_id]"/>
    <TextObject Name="Text3" Left="189" Top="18.9" Width="292.95" Height="18.9" Text="[SqlDataSource1.name]"/>
    <TextObject Name="Text5" Left="500.85" Top="18.9" Width="132.3" Height="18.9" Text="[SqlDataSource1.owner]"/>
    </DataBand>
    <PageFooterBand Name="PageFooter1" Top="153.75" Width="718.2" Height="18.9"/>
    </ReportPage>
    </Report>

    And here is the connection string from the webconfig. Note that I'm using a VFP database.

    <add name="maillist" connectionString="Provider=VFPOLEDB.1;Data Source=c:\inetpub\wwwroot\maillist\app_data\maillist.dbc" providerName="System.Data.OleDb"/>
  • edited 2:33PM
    Please try latest FR.Net version. The 1.1.1 version that you use has a problem with VB.Net language.
  • edited 2:33PM
    AlexTZ wrote: »
    Please try latest FR.Net version. The 1.1.1 version that you use has a problem with VB.Net language.
    OK Thank you. My d/l of 1.1.1 was just last week but today I get 1.1.7 which I assume is the latest.
    The newer version produces an error that says 'Webreport' is ambiguous in the Namespace 'FastReport.Web'.
    This is a syntax error in the markup.
  • edited 2:33PM
    dfreeman wrote: »
    dfreeman wrote: »
    Please try latest FR.Net version. The 1.1.1 version that you use has a problem with VB.Net language.
    OK Thank you. My d/l of 1.1.1 was just last week but today I get 1.1.7 which I assume is the latest.
    The newer version produces an error that says 'Webreport' is ambiguous in the Namespace 'FastReport.Web'.
    This is a syntax error in the markup.
    OK, with a lot of hassle redoing the GAC and toolbox and references I finally got it to compile and run. Only problem is, I'm back to the original error.

    'Object reference not set to an instance of an object. '
  • edited 2:33PM
    I decided to try it without the master page and without the codebehind page. So now I have a page that looks like this:

    <!--
    <%@ Page Language="VB" %>

    <%@ Register Assembly="FastReport"
    Namespace="FastReport.Web"
    TagPrefix="cc1" %>

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

    <script runat="server">

    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">;
    <head runat="server">
    <title>Untitled Page</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConnectionString="<%$ ConnectionStrings:maillist %>"
    ProviderName="<%$ ConnectionStrings:maillist.ProviderName %>"
    SelectCommand="SELECT list_id, name, owner FROM list_definitions ORDER BY name">
    </asp:SqlDataSource>

    <h2>FAST REPORT TEST PAGE</h2>

    <cc1:WebReport ID="WebReport1"
    runat="server"
    ReportDataSources="SqlDataSource1"
    ReportFile="~/app_data/testreportinside.frx" />
    </div>
    </form>
    </body>
    </html>

    -->

    And this actually works except that I only get the first record from the data in the report. >>
  • edited 2:33PM
    Regarding the "Object reference" error - do you have a stack trace?

    Regarding your last post - please check that "Data" band in the report is connected to data source.
  • edited 2:33PM
    AlexTZ wrote: »
    Regarding the "Object reference" error - do you have a stack trace?

    Regarding your last post - please check that "Data" band in the report is connected to data source.
    Here is the stack trace on the error.

    Server Error in '/MailList' Application.

    Control 'WebReport1_ctl05' of type 'DropDownList' must be placed inside a form tag with runat=server.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: Control 'WebReport1_ctl05' of type 'DropDownList' must be placed inside a form tag with runat=server.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:


    [HttpException (0x80004005): Control 'WebReport1_ctl05' of type 'DropDownList' must be placed inside a form tag with runat=server.]
    System.Web.UI.Page.VerifyRenderingInServerForm(Control control) +8689747
    System.Web.UI.WebControls.ListControl.AddAttributesToRender(HtmlTextWriter writer) +41
    System.Web.UI.WebControls.DropDownList.AddAttributesToRender(HtmlTextWriter writer) +47
    System.Web.UI.WebControls.WebControl.RenderBeginTag(HtmlTextWriter writer) +20
    System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +20
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
    System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
    System.Web.UI.HtmlControls.HtmlTableRow.RenderChildren(HtmlTextWriter writer) +46
    System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
    System.Web.UI.HtmlControls.HtmlTable.RenderChildren(HtmlTextWriter writer) +46
    System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
    System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10
    FastReport.Web.WebReport.RenderContents(HtmlTextWriter writer) +86
    System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
    System.Web.UI.Page.Render(HtmlTextWriter writer) +29
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266




    Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082

    and here is the report XML. It looks like its databound to me.

    <?xml version="1.0" encoding="utf-8"?>
    <Report ReportInfo.Created="06/01/2009 14:02:11" ReportInfo.Modified="06/01/2009 14:42:55" ReportInfo.CreatorVersion="1.1.7.0">
    <Dictionary>
    <ViewDataSource Name="SqlDataSource1" ReferenceName="SqlDataSource1" Enabled="true">
    <Column Name="list_id" DataType="System.Int32"/>
    <Column Name="name" DataType="System.String"/>
    <Column Name="owner" DataType="System.String"/>
    </ViewDataSource>
    </Dictionary>
    <ReportPage Name="Page1">
    <ReportTitleBand Name="ReportTitle1" Width="718.2" Height="37.8"/>
    <PageHeaderBand Name="PageHeader1" Top="41.8" Width="718.2" Height="28.35">
    <TextObject Name="Text1" Left="56.7" Top="9.45" Width="94.5" Height="18.9" Text="[SqlDataSource1.list_id]"/>
    <TextObject Name="Text2" Left="189" Top="9.45" Width="311.85" Height="18.9" Text="[SqlDataSource1.name]"/>
    <TextObject Name="Text3" Left="529.2" Top="9.45" Width="94.5" Height="18.9" Text="[SqlDataSource1.owner]"/>
    </PageHeaderBand>
    <DataBand Name="Data1" Top="74.15" Width="718.2" Height="75.6"/>
    <PageFooterBand Name="PageFooter1" Top="153.75" Width="718.2" Height="18.9"/>
    </ReportPage>
    </Report>


    Thanks.
  • edited 2:33PM
    1) Thanks for the info, we will try to find the solution asap.

    2) Your data band is not connected to data source:
    <DataBand Name="Data1" Top="74.15" Width="718.2" Height="75.6"/>

    there should be the DataSource="SqlDataSource1" attribute. To correct this, go the designer, double-click the databand and select datasource.
  • edited 2:33PM
    I've tried to reproduce the bug with my markup:
    <body>
        <form id="form1" runat="server">
        <div>
            <cc1:WebReport ID="WebReport1" runat="server" 
                ReportDataSources="SqlDataSource1" 
                ReportResourceString="--skipped--" />
        </div>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:DVDCollectionDatabaseConnectionString %>" 
            SelectCommand="SELECT * FROM [DVDs]"></asp:SqlDataSource>
        </form>
    </body>
    

    Original markup works well. The error happens if I delete runat="server" from the <form> node:
    <form id="form1">

    So, if you place WebReport in your form, be sure that it is configured to run at server.
  • edited June 2009
    AlexTZ wrote: »
    I've tried to reproduce the bug with my markup:
    <body>
        <form id="form1" runat="server">
        <div>
            <cc1:WebReport ID="WebReport1" runat="server" 
                ReportDataSources="SqlDataSource1" 
                ReportResourceString="--skipped--" />
        </div>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:DVDCollectionDatabaseConnectionString %>" 
            SelectCommand="SELECT * FROM [DVDs]"></asp:SqlDataSource>
        </form>
    </body>
    

    Original markup works well. The error happens if I delete runat="server" from the <form> node:
    <form id="form1">

    So, if you place WebReport in your form, be sure that it is configured to run at server.
    The attached ZIP contains my test project. Note that FastReports.aspx will work OK. However testpage2.aspx will not. The only difference I see is the latter uses a master page and code behind file.
  • edited 2:33PM
    I've found the bug, FR cannot locate the datasource and throws null reference exception. I will try to fix it in the tomoroow's daily build.
  • edited 2:33PM
    AlexTZ wrote: »
    I've found the bug, FR cannot locate the datasource and throws null reference exception. I will try to fix it in the tomoroow's daily build.
    Hi Alex -
    Were you able to resolve this bug?
    Thanks
  • edited 2:33PM
    Yes - try the latest version, it should work now.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.