0
votes

I am using Visual Studio 2017 and SQL Server 2017 and the last version of Crystal Reports. I then create a stored procedure in SQL Server and a new report in Visual Studio (C#) using the code to get the connection info from the app.config.

When I try to make the program work in PC client, I have the problem failed to open connection temp - the error is illustrated in the screenshot below.

This is the code for the connection info:

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();

Error:

image

1

1 Answers

-1
votes

That error code (17) means: "Server does not exist or access denied."

Hopefully, that should point you in the right direction.