Sunday, 9 October 2016

winforms - How to configure app.config file in C#?




I have my TCP port number, credentials and an IP address. How do I apply all of this to an app.config file to make it link to my database on another computer? I would like to apply it to my app.config file.


Answer






connectionString="Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;"/>





The key is the Network Library=DBMSSOCN; which tells your code to connect using TCP/IP. 1433 is the defualt port used by SQL Server (assuming your database is SQL Server). TCP/IP is often the best for a firewalled environment.


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...