views:

79

answers:

1

Hi, I have report with subreports. Part of them are using OBDC database type. I want to set all subreports to OLE DB with new connection parameters I've tried the following but as I understand this isn't enough.

for (int i = 0; i <= rd.DataSourceConnections.Count - 1; i++)
{
  rd.DataSourceConnections[i].SetConnection(logonProps["Data Source"].ToString(),
                                                          logonProps["Initial Catalog"].ToString(), 
                                                          true);
 }
 for (int i = 0; i <= rd.Subreports.Count - 1; i++)
 {
   for (int x = 0; x <= rd.Subreports[i].DataSourceConnections.Count - 1; x++)
                {
                    rd.Subreports[i].DataSourceConnections[x].SetConnection(logonProps["Data Source"].ToString(),
                                                                            logonProps["Initial Catalog"].ToString(),
                                                                            true);
                }
            }

What property should I set to change database type?

A: 

i haven't answer for your question but i think you want create report from known data source. if its true you can read data into a c# data source like DataTable or List and set it as data source of sub report

rptMain.Subreport[0].SetDatasource(_dataTable);

ali moharrami