Page 1 of 2
create report with c# code
Posted: Sat Mar 26, 2011 11:33 pm
by lilinikco
hi all.
I need to select some columns and then create sample reports with this columns via code not via designer.pleas guide me how to create report with code?
create report with c# code
Posted: Mon Mar 28, 2011 12:33 am
by Alex K.
Hello,
Please see the sample project in attachment.
Thank you.
create report with c# code
Posted: Mon Apr 04, 2011 8:36 am
by Jeniffer
Hello
we check that sample,but we would like to use it in a web page and bind the databind to a sqlsource instead of binding to a xml file that you use in this sample,could you help us to chang the codes for databinding part?
create report with c# code
Posted: Tue Apr 05, 2011 7:43 am
by Alex K.
Hello,
You can use the following code:
Code: Select all
string connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\DATA\NWIND.MDB;Persist Security Info=False";
DataTable dt = new DataTable("Categories");
using (OleDbConnection conn = new OleDbConnection(connString))
{
OleDbCommand cmd = new OleDbCommand("SELECT * FROM Categories", conn);
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(dt);
}
report.RegData(dt);
report.Dictionary.Synchronize();
instead:
Code: Select all
DataSet ds = new DataSet("Demo");
ds.ReadXmlSchema("e:\\Demo.xsd");
ds.ReadXml("e:\\Demo.xml");
DataTable dt = new DataTable("Categories");
dt = ds.Tables["Categories"];
Thank you.
create report with c# code
Posted: Thu Apr 07, 2011 12:56 am
by Jeniffer
Hi Aleksey
I really appreciate your concern. Your code works great on Winforms but it have some problems on Webforms.It bind the data to the connection,but it dosen't show anything.
could you check it yourself on webform and tell me what's my mistake?
Thank you very much for your help.
create report with c# code
Posted: Thu Apr 07, 2011 1:00 am
by Jeniffer
Maybe i must do some changes in webforms.Could you help me?
sincerely yours
create report with c# code
Posted: Thu Apr 07, 2011 5:59 am
by Alex K.
Hello,
If you want to display data in the WebDesigner in prewiew, you need to implement the GetPreviewDataSet method for a designer in your code.
Thank you.
create report with c# code
Posted: Thu Apr 07, 2011 7:06 am
by Jeniffer
Hi Aleksey
You mean i must create the report,bind it to the datasouce and so on ,in GetPreviewDataSet event of StiWebDesigner?
sincerely yours
create report with c# code
Posted: Thu Apr 07, 2011 9:32 am
by Jeniffer
Can you be a bit more precise and tell the changes in codes with presise details in that method?
I appreciate it very much!
sincerely yours
create report with c# code
Posted: Fri Apr 08, 2011 8:59 am
by Alex K.
Hello,
Sorry for the delay with response. We need some additional time to prepare the sample project for you.
Thank you.