Click here to Skip to main content
13,292,376 members (68,660 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have to Connect to database Which is in a remote machine. Database is in SQL Server 2008 is in remote Machine Where Admin login and password and SQL login is known.
Posted 26-Sep-12 3:33am
Malli_S 26-Sep-12 9:45am
Where are you stuck? What's the exact problem?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Hi Ramesh, its easy to use SqlConnection Class. You just need to build a connection string and create an instance of SqlConnection.

string ConnectionString = "Data Source=[your remote server IP]\[username];Initial Catalog=[databasename to connect];Persist Security Info=True;User ID=[sqluserid];Password=[sqluserPassword]"
SqlConnection sqlConn = new SqlConnection(ConnectionString);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171207.1 | Last Updated 26 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100