0
我在Windows窗體應用程序C#中有mysql數據庫,我想使用水晶報表進行報告,但我想連接到數據庫而沒有報表嚮導,因爲我想讓我的應用程序獨立於數據庫服務器地址,而我的應用程序有這個選項可以設置數據庫服務器地址連接.how可以達到這個目標嗎?數據庫連接水晶報表
預先感謝您。
我在Windows窗體應用程序C#中有mysql數據庫,我想使用水晶報表進行報告,但我想連接到數據庫而沒有報表嚮導,因爲我想讓我的應用程序獨立於數據庫服務器地址,而我的應用程序有這個選項可以設置數據庫服務器地址連接.how可以達到這個目標嗎?數據庫連接水晶報表
預先感謝您。
如this article,我想你可以手動通過connectionStrings
你的情況:
// Get document
ReportDocument doc = this.CrystalReportSource1.ReportDocument;
// Set connection string from config in existing LogonProperties
doc.DataSourceConnections[0].LogonProperties.Set("Connection String",
ConfigurationManager.AppSettings["connectionString"]);
// Add existing properties to a new collection
NameValuePairs2 logonProps = new NameValuePairs2();
logonProps.AddRange(doc.DataSourceConnections[0].LogonProperties);
// Set our new collection to be the defaults
// This causes Crystal Reports to actually use our changed properties
doc.DataSourceConnections[0].SetLogonProperties(logonProps);