Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 access remote SQL server from host application

Author  Topic 

babids
Starting Member

3 Posts

Posted - 2007-01-16 : 13:53:17
My company is going to host an application on a host server. what is the best way to access the remote sql server from a host application located in host server using asp.net?? Any thought

tmitch
Yak Posting Veteran

60 Posts

Posted - 2007-01-16 : 19:07:11
You will need to access the System.Data.SqlClient namespace to connect to a SQL Server machine from an ASP.NET application, regardless of whether the server is local or remote. To create a simple connection, declare and configure a new SqlConnection:

SqlConnection conn = new SqlConnection("server=255.255.255.255;database=MyDB;user id=My_uid;password=My_Password;");

Of course, replace the dummy values above with your own values. For some quick and easy help on the appropriate connection string to use, check http://www.connectionstrings.com

A trip through MSDN and the System.Data.SqlClient namespace will also be helpful.

Hope this helps...
Tim
Go to Top of Page
   

- Advertisement -