Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i created crystal report,in that i use database expert option and crate new connection take one table from database(SQL SERVER 2005) and drag and drop some field,finally report is run,this is done in integrated security=true,

when that project i run on other local machine,report ask for login,so i wnt change connection string,how it to done?
Posted

hey man,

just create the keys for using the below code. you just change the ServerName key value where the database is located.


code is below,

strServer= ConfigurationManager.AppSettings["ServerName"].ToString();
strDatabase= ConfigurationManager.AppSettings["DataBaseName"].ToString();
strUserID= ConfigurationManager.AppSettings["UserId"].ToString();
strPwd= ConfigurationManager.AppSettings["Password"].ToString();

report.DataSourceConnections[0].SetConnection(strServer, strDatabase, strUserID, strPwd);


please let me know if you have any doubt
 
Share this answer
 
Crystal Reports doesn't play nicely when you change servers... you need to implement some code that takes your crystal report, changes the database, login, server name etc, then opens the report (at run time).

This article gives you the basics on it: Changing Crystal Report Database logon information at runtime in VS2005[^]

Alternatively, google Crystal Reports change login at runtime.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900