Click here to Skip to main content
15,909,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a WindowsForm project with reportviewer control in VS2012. During the creation of the project, the connection string was defined (e.g. ServerNmae.myDatabase). the project is compiled and a projectName.exe.config file is also created with contents as follows.


<configuration>
<configsections>

<connectionstrings>
<add name="ServerName.Properties.Settings.myDatabaseConnectionString">
connectionString="Data Source=SERVERNAME;Initial Catalog=mydatabase;Integrated Security=True"
providerName="System.Data.SqlClient" />

<startup>
<supportedruntime version="v4.0" sku=".NETFramework,Version=v4.5">




Works great. now I want to take this application and run it in a different server that contains the same database (e.g. mydatabase). Can this be done just by editing the Data source SERVERNAME?
That is what I have done so far but the report does not get populated. so I need to know if it should work or troubleshoot something else.
Posted

1 solution

There are few options to check what is the issue when running application on different pc or server. You con display exception details by using message box or write exception details to a log file. Then you know exactly what's happening in run time. Use try.. catch. Block to capture exceptions.
When you using integrated security in the connection, it will check whether application exciting user has privileges to sql server. If your application and sql server running in the same machine then integrated security will work most of the time. When you connect from different pc to sql server, make sure that windows user/executing domain user having pevileges to sql server or you can change to sql server authentication by using sql server user name and password in the connection string. Check https://www.connectionstrings.com/sql-server/[^] for connecting string formats
 
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