Click here to Skip to main content
15,891,787 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have developed an application & using crystal report in it. But when i run that application in another system it ask for database credentials (user name, password, server, database) & server, database shows in textbox read only format. The matter is that i had already set new database (new system) credentials in web.config & in coding part. But i dnt know why it show previous system databse connection.

May be this is possible, when i create crystal report i had set a wizard connection in it (user name, password, server, database). So i shows wizard connection rather than C# coding connection.

One more question if we have to change wizard connection then how we run application on server because at there we provides server database credentials. So in this case we have to change database connection while we live our application with crystal report. Or we set our database connection somewhere.

Anyone who know the solution, kindly guide. Thanks in Advance.
Posted

1 solution

Do not try creating reports directly from tables or stored procedures.
Load the required data in datasets or datatables. Set these dataset or datatable as the report source for the report. That way you will not be prompted to give the database credentials.

Just follow the simple steps:
1. Create a command object with "select * from employee"

2. Use a dataadapter to get the data and populate it in the dataset.

3. Use the ds.WriteXmlSchema("A local folder in hard drive") function. Run and stop
the application. so that schema will be saved at the given path.

4. Add Crystal Report to your project from Solution Explorer.

5. Crystal Report Wizard will prompt you to give the data source. Choose the
ADO.NET(XML) and the path of the schema file. The report will be created
using the schema.
6. If there is any change in the structure just click "Verify Database".
 
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