set datasource

Stimulsoft Ultimate discussion
maryam
Posts: 26
Joined: Tue Jun 05, 2012 1:13 am

set datasource

Post by maryam »

hello, I use your suggesstion "use several data table and set to the a data set then regdata(dataset) in the code", but I have a problem that don't show me the report with some table when I use a table, this suggesstion is useful, but for 2 or up this is not useful.would u help me?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

set datasource

Post by Alex K. »

Hello,
the problem is not running in the designer but running in the csharp application
I append the code
This issue occurs due to because deleted and then created relations have new names.
Please try to use the following code:

Code: Select all

report.Dictionary.Databases.Clear();
//report.Dictionary.DataSources.Clear();
report.RegData("Doku", ds);
//report.Dictionary.Synchronize();
report.Show();

Thank you.
maryam
Posts: 26
Joined: Tue Jun 05, 2012 1:13 am

Re: set datasource

Post by maryam »

I use ypur suggestion but don't show any thing in report, my code is here and i attached my report, can you say me, where is my problem,

Code: Select all

 DataSet ds = new DataSet();
                ds.Tables.Add(dtreport);
                ds.Tables.Add(dtItm);
                ds.Tables.Add(dtItmType);
                report.Dictionary.Clear();
                report.DataSources.Clear();
                report.RegData("PoolItem", ds);
                report.Compile();
                    if (dtGridItm.Rows.Count != 0)
                    {
                        report.Show();
                    }
thanks for your attention.
Attachments
poolDeliveriItm.mrt
(27.32 KiB) Downloaded 328 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: set datasource

Post by HighAley »

Hello.

Please, check if TableName property of adding Table correspond ones in the report.
Try to call report.Design() and check it in the Designer.

Thank you.
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

Re: set datasource

Post by amitkaushik »

Yes I also hav issue here, I have multiple datasource on mrt template, and Parameters like;

report1.CompiledReport.DataSources["DS1"].Parameters["@ID"].ParameterValue = id;
report.RegData("DS2", dataset1);

and I have one datasource that needed to connected with c# I want to assign datatable object to Stimulsoft DS.
will it possible...
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: set datasource

Post by Alex K. »

Hello,

Please try to set the parameters value before compile report and after RegData method.

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: set datasource

Post by HighAley »

Hello.

Please, read next article in our Knowledge base. http://stimulsoft.helpserve.com/index.p ... ticleid=69

Thank you.
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

Re: set datasource

Post by amitkaushik »

Can I add c# dataset or datatable in place of querry, here...

StiSqlSource DS1 = new StiSqlSource("Connection", "DS1", "DS1", "SELECT * FROM DS1", true, false);
report.Dictionary.DataSources.Add(DS1);


it is fine but I want to add my datatable (with values) to datasource, its run but no data found on report.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: set datasource

Post by Alex K. »

Hello,

You can use the following code:
New connection string:
Code:
report.Dictionary.Databases.Clear();
report.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", newConnectionString));

Add DataSources:
Code:
StiSqlSource DS1 = new StiSqlSource("Connection", "DS1", "DS1", "SELECT * FROM DS1", true, false);
report.Dictionary.DataSources.Add(DS1);

Add Columns:
Code:
foreach (DataColumn col in dataTableDS1.Columns)
{
DS1.Columns.Add(col.ColumnName, col.DataType);
}
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

Re: set datasource

Post by amitkaushik »

Thankyou its good.
Post Reply