We design reports aginst sql tables. But when we render it programmatically we want to change all those reports to use Views. But it is not working, here is how my code looks like,
StiDataSourcesCollection collectionDS = stiReport1.Dictionary.DataSources;
foreach (StiDataSource ds in collectionDS) {
if (ds.Name.ToLower() == "asset") {
ds.Name = "v_Asset1998011";
}
if (ds.Name.ToLower() == "location") {
ds.Name = "v_Location1998001";
}
I get all kinds of error. Can someone help me how to do this.
Note: Table and View are having exact columns and everything..
Thanks
changing table to view...
changing table to view...
I think i figured it out... here is the modified code that works...
StiDataSourcesCollection collectionDS = stiReport1.Dictionary.DataSources;
foreach (StiSqlSource ds in collectionDS) {
if (ds.Name.ToLower() == "asset") {
ds.SqlCommand = ds.SqlCommand.ToLower().Replace("asset", "v_Asset1998011");
}
if (ds.Name.ToLower() == "location") {
ds.SqlCommand = ds.SqlCommand.ToLower().Replace("location", "v_Location1998001");
}
}
StiDataSourcesCollection collectionDS = stiReport1.Dictionary.DataSources;
foreach (StiSqlSource ds in collectionDS) {
if (ds.Name.ToLower() == "asset") {
ds.SqlCommand = ds.SqlCommand.ToLower().Replace("asset", "v_Asset1998011");
}
if (ds.Name.ToLower() == "location") {
ds.SqlCommand = ds.SqlCommand.ToLower().Replace("location", "v_Location1998001");
}
}