1
我在運行時更改了連接字符串,但未從新連接字符串 中選取記錄。代碼是:在運行時更改連接字符串在晶體報告中並根據新連接記錄
private void Report_Load(object sender, EventArgs e)
{
try
{
foreach (ConnectionInfo item in Tests1.DataSourceConnections)
{
item.SetConnection(@".\sqlexpress", @"C:\DBFile\fff2011.mdf", true);
}
crystalReportViewer1.ReportSource = Tests1;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}