Loading DataTable to Excel Format

Stimulsoft Reports.NET discussion
Post Reply
BigStar
Posts: 3
Joined: Sun Feb 05, 2017 5:31 am

Loading DataTable to Excel Format

Post by BigStar »

Hello,

I'm using ASP.NET web form and VB Language to create report generating page and getting data from created stored procedure that was wrote in MSSQL with 3 input variables. That data were returned as "datatable" datatype in program. I try to bind datatable to report with these codes:

' ------------------------------------------ Data that reurned in datatable format from --------------------------------------------------
Dim ReportInfo As DataTable = ContractReport.GetDetialReport(ContractId, Session("sdate"), Session("edate"))
' -------------------------------------------------------------------------------------------------------------------------------------------------
Dim Report As StiReport = New StiReport()
Report.Load(Server.MapPath("~/reports/Reports.mrt"))
Report.RegData("ReportInfo", ReportInfo)
Report.Render(False)
Dim mySettings = New StiExcelExportSettings()
mySettings.ExportDataOnly = True
mySettings.UseOnePageHeaderAndFooter = True
StiReportResponse.ResponseAsXls(Report, mySettings, True)

I create report template with name of "Reports.mrt" that have no connected to database.With all of attemptions, the generated report was empty. Could you please show me how to do it with sample.

Thanks in advance.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Loading DataTable to Excel Format

Post by HighAley »

Hello.

Do you have such Data Source in your report?
What data connection do you use in the report?
Could you send us your report template?

Thank you.
BigStar
Posts: 3
Joined: Sun Feb 05, 2017 5:31 am

Re: Loading DataTable to Excel Format

Post by BigStar »

Yes, I retrieve that Data Source from Data Access defined layer and pass information of database to method of logic layer. I also connect designed report in stimulsoft to database and select specified stored procedure.In below picture I design that report and save in one of folder in my project.

Thank you very much.
Attachments
Stimulsoft-DesignedReport.png
Stimulsoft-DesignedReport.png (65.32 KiB) Viewed 2067 times
BigStar
Posts: 3
Joined: Sun Feb 05, 2017 5:31 am

Re: Loading DataTable to Excel Format

Post by BigStar »

Hello,

I Find solution. I Add below code:

Report.Load(Server.MapPath("~/reports/Reports.mrt"))
Report.Compile()
Report("@FDate") = Convert.ToString(Session("sdate"))
Report("@TDate") = Convert.ToString(Session("edate"))
Report("@ContractID") = Convert.ToInt32(ContractId)
Report.Render()

and problem solved.

Thanks again.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Loading DataTable to Excel Format

Post by Alex K. »

Hello,

Ok.
Please let us know if you need any additional help.

Thank you.
Post Reply