Sunday, February 12, 2012

connect to sql server from other computer

hi

i have 2 computers named pc1 , pc2 .

i have lan connect between this computers.

in pc1 i have server named center , in this server data base named library.

how i can connect to this database from pc2 .

note: i am working with visual basic 2005 .

please help me ,

Do you get any exception ? You just have to setup a sqlconnection via .NET and connect to the server, the simplest statement would be in C# something like:

new SqlConnection("Data Source=YourServerName;Initial catalog=library").Open()

The conenction string uses integrated authentication, I don′t know if that applies to you.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

are you programming a windows application

or ASp.net?

|||thanks alot .|||i am using windows application|||

Are these two servers in the same domain? If not, you'd better first configure the authentication mode of the SQL Server to Mixed Authentication and change the password of the sa account, which by default is blank.

After this, you can specify a connection string for the SqlConnection class in VB.NET, specifying the machine name of the sql and username and password. After this, you should be able to connect to the remote server. It is not much different from connecting to a local sql.

|||

thanks for reply .

best regards

No comments:

Post a Comment