Hello to you,
I'm newbie in .net world, also newbie using stimulsoft report.
I'm using VB.NET 2005, StimulReport 2008.2, MS-ACCESS 2000 database
How to passing data to report ?
The scenario is :
I hv database named "ABC"
contains TBLCUSTOMER (CustomerID, CustomerName, Address)
I hv a Form, named "Form1"
contains button "btnPreview"
I want to do is :
When "btnPreview" clicked, I want to passing the data table (dt) for customername like 'J%' to preview
I try put some code to btnPreview as shown :
Public dt As DataTable
Public da As OleDb.OleDbDataAdapter
da = New OleDb.OleDbDataAdapter("select * from tblCustomer where customerid like 'J%'", pCnn2AppDB)
dt = New DataTable()
da.Fill(dt)
Dim rpt As New Stimulsoft.Report.StiReport
rpt.Load("c:\test.mrt")
rpt.RegData("dt", dt)
rpt.Show()
from above code, the report will shown all the data, but I just want to show for CustomerName like 'J%'
Please show me the code & guide me step by step.
or maybe I'm wrong in creating TEST.MRT ???
When creating TEST.MRT, I create Connection, named dt, also creating datasource named it as dt
NOTE : Actually I want attach TEST.MRT, but I don't how to attach it witihin this forum.
regards,
Steven
email : stvhui@yahoo.com
How to passing data table to report ? customername like 'J%'
How to passing data table to report ? customername like 'J%'
- Attachments
-
- 172.test.mrt
- (7.68 KiB) Downloaded 494 times
How to passing data table to report ? customername like 'J%'
Hello,
Thank you.
In this case you can use 'Data from DataSets, DataTables' Datasource (you got this answer also in another topic).stvhui wrote:How to passing data to report ? The scenario is :
...
Dim rpt As New Stimulsoft.Report.StiReport
rpt.Load("c:\test.mrt")
rpt.RegData("dt", dt)
rpt.Show()
Please check "SimpleProject" example in attachment. In this example you can send CustomerName to report via Variable.stvhui wrote:from above code, the report will shown all the data, but I just want to show for CustomerName like 'J%'
Please show me the code & guide me step by step.
Thank you.
- Attachments
-
- 173.SimpleProject.zip
- (296.96 KiB) Downloaded 1082 times
How to passing data table to report ? customername like 'J%'
Hello Ivan,
Thanks for reply, but I dont understand yr attached code.
Could you tell me, how I can passing run-time query to the report template ?
Thanks for reply, but I dont understand yr attached code.
Could you tell me, how I can passing run-time query to the report template ?
How to passing data table to report ? customername like 'J%'
Hello,
If you want passing run-time query to the report template, please use next code, for example:
Thank you.
In "SimpleProject" example, CustomerName is passed to the report's variable, and then passed to the DataBand's filter.stvhui wrote:Thanks for reply, but I dont understand yr attached code.
Could you tell me, how I can passing run-time query to the report template ?
If you want passing run-time query to the report template, please use next code, for example:
Code: Select all
(report.Dictionary.DataSources["dt"] as StiOleDbSource).SqlCommand = "select * from tblcustomer where CUSTOMERID=1";
report.Compile();
report.Render(true);
report.Show();
How to passing data table to report ? customername like 'J%'
Hi,
My friend told me add some code at the end of my previous posted code as :
rpt.Dictionary.Synchronize()
rpt.Dictionary.DataSources(0).Name = "dt"
rpt.Dictionary.DataSources(0).Alias = "dt"
rpt.Show()
But It's not work, why ?
I don't hv any help about dictionary ?
My friend told me add some code at the end of my previous posted code as :
rpt.Dictionary.Synchronize()
rpt.Dictionary.DataSources(0).Name = "dt"
rpt.Dictionary.DataSources(0).Alias = "dt"
rpt.Show()
But It's not work, why ?
I don't hv any help about dictionary ?