SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 my project is not connecting on another machine
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Abid
Posting Yak Master

Pakistan
105 Posts

Posted - 07/06/2013 :  02:32:17  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

United Kingdom
2019 Posts

Posted - 07/06/2013 :  04:05:14  Show Profile  Visit jackv's Homepage  Reply with Quote
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
Posting Yak Master

Pakistan
105 Posts

Posted - 07/06/2013 :  07:49:00  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 07/07/2013 :  10:30:30  Show Profile  Reply with Quote
(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
Flowing Fount of Yak Knowledge

United Kingdom
2019 Posts

Posted - 07/09/2013 :  08:07:24  Show Profile  Visit jackv's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000