0

How can I make a setting so that I can connect to the server in SQL Server 2008 R2? I mean when my program runs I need to insert first the data source, initial catalog etc. so that I can connect to the server.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Qwerty
  • 55
  • 3
  • 10
  • you want the user to be able to enter the connection information or is it just a configuration? – weeksdev May 16 '15 at 13:56
  • yeah the user may enter the connection string, how can i do that? – Qwerty May 16 '15 at 14:06
  • 1
    Data access with C# depends on the data access library you plan to use. (Entity Framework, ADO.Net, Dapper, NHibernate, etc.) It also helps to know what type of project you are writing (console, web, win32, universal app) as there is a conventional place to put the configuration for each. If you can provide a couple details, we'd be happy to help! – Dan Sorensen May 16 '15 at 14:15

2 Answers2

0

This answer might point you in the right direction if you're using Entity Framework to access your database:

Setup Entity Framework For Dynamic Connection String

Community
  • 1
  • 1
0

Create a form which asks for those values via TextBoxes, etc. Store them in a configuration file/Database table & you are there..

Abdul Rehman Sayed
  • 6,532
  • 7
  • 45
  • 74