How can I work with a complete dataset template?

Stimulsoft Reports.Silverlight discussion
Locked
gustavo
Posts: 16
Joined: Fri Jan 06, 2012 11:23 am

How can I work with a complete dataset template?

Post by gustavo »

The idea was to provide a full database template to let designers work with any restriction...
but in my test, i'm working with 2 tables with relations...

so... when this report is rendered, i need to fill this two dataset tables...
and if i put all my tables in this dataset?

what is the best way to work with this?
or how can i provide all the database tables/fields to designers without show the connection string (that is a problem for us too)...

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

How can I work with a complete dataset template?

Post by Alex K. »

Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?

Thank you.
gustavo
Posts: 16
Joined: Fri Jan 06, 2012 11:23 am

How can I work with a complete dataset template?

Post by gustavo »

i created a dataset file and inserted all my database tables on it...

when i create i new report...
StiReport report = new StiReport();
report.RegData("Data", new MyDataSet);
report.Dictionary.Synchronize();

this allow the designers to create reports usning any table that they want.

but the problem comes when i show de report...
because i don't know wich tables the designers have used...

so... in this case i fill all tables from MyDataSet with database records... (select * from .... ) using SQL adapter.

in Render method i have this "Ugly" code:

System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(MyConnectionString);
System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter("select * from Product", conn);
System.Data.SqlClient.SqlDataAdapter da2 = new System.Data.SqlClient.SqlDataAdapter("select * from Order", conn);
..
.

MyDataSet ds = new MyDataSet();
da.Fill(ds.Product);
da2.Fill(ds.Order);
..
.

report.RegData("Kankei", MyDataSet);


and my question is:
How can i make it better?

example: Using a direct connection to database... but i cannot show the connection string to designers...

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

How can I work with a complete dataset template?

Post by HighAley »

Hello.

You could hide connection string using next code:

Code: Select all

report.Dictionary.Restrictions.Add("DataSourceName", StiDataType.DataSource, StiRestrictionTypes.DenyEdit);
StiConfig.HideProperty("SqlCommand");
Does it meet your needs?

Thank you.
gustavo
Posts: 16
Joined: Fri Jan 06, 2012 11:23 am

How can I work with a complete dataset template?

Post by gustavo »

but as Aleksey's reply on this post:
http://forum.stimulsoft.com/Default.asp ... 167&#24167

this command is not avaliable at the moment for this current version..
"report.Dictionary.Restrictions.Add("DataSourceName", StiDataType.DataSource, StiRestrictionTypes.DenyEdit);"

but i founded a better solution in another post...
I'm using this method to get the used tables from my registered dataset

var dataTables = StiDataSourceHelper.GetUsedDataSourcesNames(report).Keys.Cast().ToArray();
foreach (var tableName in dataTables)
{
SqlDataAdapter da = new SqlDataAdapter("select * from " + tableName, conn);
da.Fill(MyDataSet.Tables[tableName]);
}

Thanks for the help!!
but i would like to see this Dictionary.Restrictions working for silverlight designers too
or if its working in the current version... i'm using 2011.3... let me know!!


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

How can I work with a complete dataset template?

Post by HighAley »

Hello
gustavo wrote:but i would like to see this Dictionary.Restrictions working for silverlight designers too
or if its working in the current version... i'm using 2011.3... let me know!!
We made some improvements. Please, check our next prerelease build this week.

Thank you.
Locked