Last post Sep 30, 2014 04:00 AM by Fei Han - MSFT
Sep 22, 2014 03:38 PM|JoeSchmoe115|LINK
I am now working on existing application that uses Crystal Reports. I have no prior exposure to Crystal Reports.
For database connection SetDatabaseLogon(username, password, servername, database) is used in the source code.
servername is one of DSN names that are setup on the server.
But DSN already specifies all credentials such as username, password and database. Is there a way to just reference DSN name for database connection to avoid hard-coding username, password and database in the source code?
Or is there a way to just use connection string from web.config instead?
Sep 30, 2014 04:00 AM|Fei Han - MSFT|LINK
Thanks for your post.
As for your problem, you could try the following code.
SqlConnectionStringBuilder SConn = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
cryRpt.SetDatabaseLogon(SConn.UserID, SConn.Password, SConn.DataSource, SConn.InitialCatalog);
Hope it will be helpful to you.