2009-05-21 39 views
0

我有一個報告,在鏈路子報表點擊當我得到數據庫登錄form.I給了所有必要的連接字符串,但仍然它要求登錄info.sub報告在我的本地系統打開,但當安裝在客戶端系統時,我遇到了這個問題。我錯過了什麼,或者我該怎麼做?數據庫登錄提示時點擊子報表

+0

你如何在報告上設置數據庫連接? – 2009-05-21 10:17:33

回答

1

我發現,設置一個水晶報表中的代碼數據庫連接時,您需要設置在報告數據庫定義上的每一臺連接。你可以這樣做:

private static void SetConnectionInfo(ReportClass report, string ReportServer, string ReportDatabase) 
{ 
    TableLogOnInfo tInfo = new TableLogOnInfo(); 
    ConnectionInfo connectionInfo = tInfo.ConnectionInfo; 
    connectionInfo.IntegratedSecurity = true; 
    connectionInfo.ServerName = ReportServer; 
    connectionInfo.DatabaseName = ReportDatabase; 

    foreach (Table t in report.Database.Tables) 
    { 
     t.ApplyLogOnInfo(tInfo); 
    } 

    foreach (ReportClass subReport in report.Subreports) 
    { 
     SetConnectionInfo(subReport, ReportServer, ReportDatabase); 
    } 
}