DataSet Binding

Stimulsoft Reports.WEB discussion
Post Reply
Rodrigo V. Lagos Eustáquio
Posts: 7
Joined: Mon May 17, 2010 11:58 pm
Location: Brazil

DataSet Binding

Post by Rodrigo V. Lagos Eustáquio »

Hi,

I'm having problem with dataset binding, this is the code:

Code: Select all

    Dim Report As StiReport = New StiReport()

    With Report
      .Load(pSessionUser.ServerPath + "../bin/Reports/" + pWebFormSelected.Report + ".mrt")

      .Dictionary.Databases.Clear()
      .Dictionary.Databases.Add(New StiSqlDatabase("Connection", pConnReport))

      .ReportName = pWebFormSelected.Report

      .Dictionary.DataSources.Clear()

      If Not IsNothing(pDataSet) Then
        .RegData(pDataSet)
      End If
      .Dictionary.Synchronize()

      .Compile()
    End With

    return Report
DataSet result is:
Id_ContaPatrimonial
Descricao

So, when execute results in:

c:\Windows\Temp\vag0frrp.0.cs(132,48) : error CS0117: 'System.Data.DataSet' does not contain a definition for 'Descricao'c:\Windows\Temp\vag0frrp.0.cs(137,48) : error CS0117: 'System.Data.DataSet' does not contain a definition for 'Id_ContaPatrimonial'
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.Exception: c:\Windows\Temp\vag0frrp.0.cs(132,48) : error CS0117: 'System.Data.DataSet' does not contain a definition for 'Descricao'c:\Windows\Temp\vag0frrp.0.cs(137,48) : error CS0117: 'System.Data.DataSet' does not contain a definition for 'Id_ContaPatrimonial'

Source Error:

Line 26: .Dictionary.Synchronize()
Line 27:
Line 28: .Compile() <--- Error Line
Line 29:
Line 30: 'Titulo do Relatorio

Stack Trace:

[Exception: c:\Windows\Temp\vag0frrp.0.cs(132,48) : error CS0117: 'System.Data.DataSet' does not contain a definition for 'Descricao'c:\Windows\Temp\vag0frrp.0.cs(137,48) : error CS0117: 'System.Data.DataSet' does not contain a definition for 'Id_ContaPatrimonial']
Stimulsoft.Report.StiReport.Compile(String path, Stream stream, StiOutputType outputType, Boolean autoCreate, Object standaloneReportType) +1634
Stimulsoft.Report.StiReport.Compile() +21
BLL.BLL_Module.buildReport(cad_Usuario pSessionUser, String pConnReport, WebFormSelected pWebFormSelected, String pFiltroEsquerda, String pFiltroDireita, DataSet pDataSet) in D:\Attiva\Fontes .NET\SIAP\BLL\main\Library.vb:28
BLL.System.cad_ContaPatrimonial.imprimir(cad_Usuario pSessionUser, WebFormSelected pWebFormSelected) in D:\Documents\Visual Studio 2010\Projects\SCPA\BLL\System\cad_ContaPatrimonial.vb:90
WEB.Forms.cadContaPatrimonial.TitleButton_Click(Object sender, ImageClickEventArgs e) in D:\Documents\Visual Studio 2010\Projects\SCPA\WEB\Forms\cadContaPatrimonial.aspx.vb:28
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +115
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +120
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

Thanks for any help.
Attachments
416.cadContaPatrimonial.mrt
(18.79 KiB) Downloaded 354 times
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

DataSet Binding

Post by Andrew »

Hello,

The following problem occurs because you remove all data sources from the data dictionary using the following method: .Dictionary.DataSources.Clear()
Unfortunately, the .Dictionary.Synchronize() method can automatically synchronize data dictionary, data which are registered using the RegData method (ADO.NET DataSet). As a result of your code no one data source is found in the data dictionary and as a result the error occur.

Thank you.
Rodrigo V. Lagos Eustáquio
Posts: 7
Joined: Mon May 17, 2010 11:58 pm
Location: Brazil

DataSet Binding

Post by Rodrigo V. Lagos Eustáquio »

:biggrin: Very tnks, problem solved.
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

DataSet Binding

Post by Andrew »

Perfect! :biggrin:
hadisaadat_du
Posts: 35
Joined: Tue Nov 09, 2010 2:43 pm
Location: iran

DataSet Binding

Post by hadisaadat_du »

Hi every body.
I sea allmost all topic in forum and seem int all of them posit that we know what is our tables and columns in dataset of our reportbut allways not thus
1-sometime we may want to edit the report in webdesigner that we dont know any thing about its data set but we sure it works with our data base , so befor call the design() function we pass what data set to our report via regdata(//what_dataset) ??
2- or we may want to set full access to data base to one user to create the every report that need to design well we pass a full data base to designer dictionary and he/she design every report by every columns in every tables or viwes in database and save it , in viwe report mode namely after load our report and we want to pass it to stiwebviewer we pass what data set to it since we cant pass all data base to our report ??!
papendorffc
Posts: 1
Joined: Mon Oct 24, 2016 3:44 am

Re: DataSet Binding

Post by papendorffc »

I got this error because I also used the code:

Code: Select all

Report.Dictionary.DataSources.Remove(DataSource);
I did this because I was hooking up data from an API.

In the end, I removed this line and instead just set the DataSource.DataTable property to my table containing the data.

Code: Select all

DataSource.DataTable = myTable; 
Then used

Code: Select all

RegData()
Dictionary.Synchronize()
Compile()
Works!

Thanks for the hints in this thread.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: DataSet Binding

Post by Alex K. »

Hello,

Thank you for the information.
Let us know if you need any additional help.

Thank you.
Post Reply