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
 General SQL Server Forums
 New to SQL Server Programming
 my project is not connecting on another machine

Author  Topic 

Abid

110 Posts

Posted - 2013-07-06 : 02:32:17
Hi. I made a project in VS 2005 and SQL 2005. Daily i do my homework and at morning take my work to office, where i work on same project. But when i run the program on my office computer, so it gives error that, Network-related or instance related error occurred while establishing a connection to SQL.The server was not found or was not accessible..

This is my connection string:

    Public strCn As String = "Data Source = (local); Initial Catalog = DDB; Integrated Security = false; User ID = sa; Password = xxx;"
.

Is it necessary that all computer System Names and SQL Server names must be same on each computer, whether client or developed?

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2013-07-06 : 04:05:14
It is possible to connect to a SQL Server on another server. From the computer you are connecting can you try rthe suggestions on http://www.sqlserver-dba.com/2012/05/cannot-connect-to-sql-server.html

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

Abid

110 Posts

Posted - 2013-07-06 : 07:49:00
Its not working. The only thing which can make me to remove this problem, is that I change the ConnectionString and replace the "Data Source = (local); to "Data Source = clientsys\DB\SQL" meaning thereby that If i simply replace the (local) to the client System name so it works. I did it and it started working. But if this is the solution, the why numerous programmer (almost everyone), uses (local) or just ( . )???
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-07 : 10:30:30
(local) or (.) works only if its the default instance. So I guess your instance was a named instance which is why you need to use machinename\instancename as the server name in connection string.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2013-07-09 : 08:07:24
You may even want to consider setting up an alias for the server name - which gives you added flexibility for moving the SQL Server Instance or if you want to change the server name

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -