开发者

Switch from odbc to oledb in crystal reports at runtime

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜