开发者

Switch from odbc to oledb in crystal reports at runtime

开发者 https://www.devze.com 2022-12-15 09:47 出处:网络
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 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?


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);

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号