0

I am developing a windows form application using c#. I want to connect to SQL Server 2008 which is in the server using windows authentication. Can anyone please provide me the connection string?

Note:

  1. Domain is created in my server.
  2. Remote access is enabled for the sql server
  3. TCP/IP port is also enabled.

Please help me.I am struggling for this since 3 days.

1
  • Can you able to connect sql server using management studio? you can use the same server name as data source.if it is not connected then you should have check you installed sql server correctly or not Commented Apr 21, 2014 at 13:38

4 Answers 4

1

Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;

Sign up to request clarification or add additional context in comments.

1 Comment

In this scenario, how can I test whether the windows user has certain permissions like db_datareader and db_datawriter and if the user doesn't have these permissions then perform Application.Exit?
0

You can try this one if it is local.it will take the default instance.I think this will help you

Data Source=.;Initial Catalog=yourDBName;Integrated Security=True

Comments

0

I am not clear on the issue you are facing, are u running the Application on your domain cred, and you're able to access the DB? . What is your current DB connection string template? (3 days, seems like a long time for this issue, i must be missing something)

Comments

0

Follow the below steps in your visual studio,

  1. Go To Tools menu and click on "Connect to Database".
  2. If it is a first time a small window will open with below options
    • Microsoft Access Database File
    • Microsoft ODBC Data Source
    • Microsoft SQL Server
    • Microsoft SQL Server Comapct 3.5
    • Microsoft SQL Server Database File
    • Oracle Database
  3. In your case, click on "Microsoft SQL Server" and click Continue.
  4. Then a new window will prompt which takes input like -Server Name -choose your server name (First time it will take some time to load list of server name). You can get your server name by opeing SQL Server.

    • Log on to the server

    option 1 - Use Windows Authentication (As this is the first time you are using, I will suggest to use this option) option 2 - use SQL Server Authentication (If your choosing this, provide your SQL Server Username and password)

  5. Connect to Database -Select or Enter the Database name (From the Dropdown select your database to which you want to connect)
  6. After filling above details, Click on "Advanced" button and it will take you to another pop-up window
    • In that window, just above "Ok" button there will be a non-editable column with name DataSource. Simply copy the text under it. This is you Connection string.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.