我的报表以前的连接是SQL_SERVER的数据库,数据库名是CP_TEST,而现在的数据库名是CP。我现在把报表的连接切换到现在的数据库,但是报表显示出来的还是以前数据库的数据。我该怎么切换过来,谢谢大家。下面是我切换数据库的代码。
TableLogOnInfo _tli = new TableLogOnInfo () ;
_tli.ConnectionInfo.ServerName = "192.168.0.1";
_tli.ConnectionInfo.DatabaseName = "CP";//新数据库名,旧的数据名是CP_TEST
_tli.ConnectionInfo.UserID = "sa";
_tli.ConnectionInfo.Password = "sa";string sFormulaSelect = " {SaleInfo.Ind} = " + sInd ; //报表里面的查询条件InvoiceReport crp = new InvoiceReport();
crp.RecordSelectionFormula = sFormulaSelect;crp.Database.Tables[0].ApplyLogOnInfo ( _logOnInfo );
crv_SD.ReportSource = crp ; //crv_SD是CrystalReportViewer但是,语句执行完后,显示的数据还是CP_TEST里面的数据。请大家帮忙,给个好的提议,我该怎么做。谢谢大家
TableLogOnInfo _tli = new TableLogOnInfo () ;
_tli.ConnectionInfo.ServerName = "192.168.0.1";
_tli.ConnectionInfo.DatabaseName = "CP";//新数据库名,旧的数据名是CP_TEST
_tli.ConnectionInfo.UserID = "sa";
_tli.ConnectionInfo.Password = "sa";string sFormulaSelect = " {SaleInfo.Ind} = " + sInd ; //报表里面的查询条件InvoiceReport crp = new InvoiceReport();
crp.RecordSelectionFormula = sFormulaSelect;crp.Database.Tables[0].ApplyLogOnInfo ( _logOnInfo );
crv_SD.ReportSource = crp ; //crv_SD是CrystalReportViewer但是,语句执行完后,显示的数据还是CP_TEST里面的数据。请大家帮忙,给个好的提议,我该怎么做。谢谢大家
推模式不使用TableLogOnInfo来设置连接信息,直接包含在连接字段里即可。
能给我例子吗?我真的好急啊[email protected]