1

以下代码在本地系统上运行良好,但在远程服务器上出现此错误:

登录失败。
详细信息:ADO
错误代码:0x
源:ADODB.Connection
描述:找不到提供程序。它可能没有正确安装。
文件 C:\Windows\TEMP\MARK_F_CARD {F5EE7A57-​​7C81-4AC5-B39E-E3E66C864F4B}.rpt 中的错误:无法连接:参数登录不正确。

任何人都可以提出任何解决方案吗?

cl.ConOpen();
DataSet dsm = new DataSet();
DataSet ds = new DataSet();

string query_report1 = "select *from ZSTUDENT where SID='" + Wsid.Text + "'";
cl.da = new SqlDataAdapter(query_report1, cl.con);
cl.da.Fill(dsm, "ZSTUDENT");

rpt.Load(Server.MapPath("../MARKSHEETDESIGN/MARK_F_CARD.rpt"));
rpt.SetDatabaseLogon("sms", "sms", "204.0.0.237", "sms");
rpt.SetDataSource(dsm);

string query_report2 = "select *from STUDENTMARK where SID='" + Wsid.Text + "'";
cl.da = new SqlDataAdapter(query_report2, cl.con);
cl.da.Fill(ds, "STUDENTMARK");

rpt.Subreports[0].SetDatabaseLogon("sms", "sms", "204.0.0.237", "sms");
rpt.Subreports[0].SetDataSource(ds);
//-------
ConnectionInfo connectionInfo = new ConnectionInfo { UserID = "sms", Password = sms", ServerName = "204.0.0.237", DatabaseName = "sms" };
TableLogOnInfo tableLogOnInfo = new TableLogOnInfo { ConnectionInfo = connectionInfo };
foreach (CrystalDecisions.CrystalReports.Engine.Table table in rpt.Database.Tables) {
    table.ApplyLogOnInfo(tableLogOnInfo);
}
foreach (CrystalDecisions.CrystalReports.Engine.Table table in rpt.Subreports[0].Database.Tables) {
    table.ApplyLogOnInfo(tableLogOnInfo);
}
//-----
rpt.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
CrystalReportViewer1.DisplayGroupTree = false;
CrystalReportViewer1.ReportSource = rpt;
4

0 回答 0