我正在使用Visual Studio 2017和SQL Server 2017以及最新版本的Crystal Reports . 然后,我在SQL Server中创建一个存储过程,在Visual Studio(C#)中创建一个新报告,使用该代码从 app.config
获取连接信息 .
当我尝试使程序在PC客户端工作时,我的问题是无法打开连接临时 - 错误在下面的屏幕截图中说明 .
这是连接信息的代码:
SaleReportCrystal aLL_PUSH_STUDENTS = new SaleReportCrystal();
System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder();
builder.ConnectionString = ConfigurationManager.ConnectionStrings["Connection"].ConnectionString; ;
string server = builder["Data Source"] as string;
string database = builder["Initial Catalog"] as string;
string UserID = builder["User ID"] as string;
string password1 = builder["Password"] as string;
aLL_PUSH_STUDENTS.SetDatabaseLogon(UserID, password1, server, database);
ReportPrint studentInforamtionRep = new ReportPrint();
studentInforamtionRep.crystalReportViewer1.ReportSource = aLL_PUSH_STUDENTS;
studentInforamtionRep.ShowDialog();
错误:
1 回答
该错误代码(17)表示:“服务器不存在或访问被拒绝” .
希望这应该指向正确的方向 .