Page 1 of 1
Retrieve Columns Automatically
Posted: Thu Mar 21, 2013 11:42 am
by tp182
I have managed to add data source through code, is there any way i can auto populate the columns from a view or stored procedure in the designer ?
Re: Retrieve Columns Automatically
Posted: Fri Mar 22, 2013 6:51 am
by Alex K.
Hello,
You can use the following code.
New connection string:
report.Dictionary.Databases.Clear();
report.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", newConnectionString));
Add DataSources:
StiSqlSource DS1 = new StiSqlSource("Connection", "DS1", "DS1", "SELECT * FROM DS1", true, false);
report.Dictionary.DataSources.Add(DS1);
Add Columns:
foreach (DataColumn col in dataTableDS1.Columns)
{
DS1.Columns.Add(col.ColumnName, col.DataType);
}
Thank you.
Re: Retrieve Columns Automatically
Posted: Fri Mar 22, 2013 10:25 am
by tp182
Thanks Aleksey I've got it working now.
Re: Retrieve Columns Automatically
Posted: Fri Mar 22, 2013 10:40 am
by Alex K.
Hello,
Ok.
Let us know if you need any additional help.
Thank you.