473,387 Members | 3,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Server Reference In SQL Server 2005 Connection String

Hello all,

I develop on two or three different machines at different times. I need
a connection string in my app that will always reference the local
instance (for whatever machine) of Microsoft SQL Server 2005. I have
found that the following will work, but I have to change the machine
name as I code on each box...

"server=MACHINENAME;database=MYDATABASE;uid=sa;pas sword=[somepassword];"

I know that I should be able to use a generic reference instead of the
actual machine name, as I used to do with SQL 2000, but it doesn't work
anymore now. I have tried...

"server=local;database=MYDATABASE;uid=sa;passw ord=[somepassword];"
"server=(local);database=MYDATABASE;uid=sa;passwor d=[somepassword];"
"server=localhost;database=MYDATABASE;uid=sa;passw ord=[somepassword];"
"server=(localhost);database=MYDATABASE;uid=sa;pas sword=[somepassword];"

....but the app times out and says "System.Data.SqlClient.SqlException:
SQL Server does not exist or access denied."

I also tried...

"server=127.0.0.1;database=MYDATABASE;uid=sa;passw ord=[somepassword];"

....but then it times out and says "System.Data.SqlClient.SqlException:
General network error. Check your network documentation."

I installed Microsoft SQL Server 2005 Developer edition on these boxes.
I installed all of the default settings and did not create special
instance names or anything. Also, the server name (local) works fine
when logging into SQL Server Management Studio.

Any suggestions?

Jan 12 '06 #1
3 1616
hey man,
try it this.
"server=127.0.0.1;database=MYDATABASE;trusted_conn ection = yes";
it should work.
Jan 12 '06 #2
Thanks, but it didn't work. The following is what I used, copied and
pasted out of the Visual Studio 2005 IDE. I only changed the database
name and password...

"server=127.0.0.1;database=MYDATABASE;uid=sa;passw ord=MYPASSWORD;trusted_connection=yes;"

Jan 12 '06 #3
Since it always wants the machine name (or presumably the IP address),
I thought about using Environment.MachineName in the connection string.
Worked like a charm.

#$#@#$@!$@#$@....Why didn't I think of this earlier?

Jan 18 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Carlos | last post by:
Hi all, I have a ASP.NET app that uses SQL Server 2000 to access the data over the internet and everything works fine . However, I just installed SQL server 2005, and wanted to test the remote...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
5
by: James | last post by:
Hello, I have written a simple logon page that redirects to another page when successful. All works fine on my computer but when I upload it I get the error message below. I have written it...
5
by: kk035 | last post by:
Hello! I'm migrating an IIS/SQL-Server application from Windows NT4.0 and SQL- Server 2000 to Windows 2003 Server and SQL-Server 2005. My problem is that it is not possible to connect local (IIS...
10
by: =?Utf-8?B?UHVuaXQgS2F1cg==?= | last post by:
Hi, I am developing a windows application in VS.NET 2005. The application is database driven and I need to deploy it on a client's pc. How should I go about developing such an application. I...
0
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ...
5
by: Cirene | last post by:
I just deployed my new ASP.NET (3.5 FW) site to the hosting company I'm using, webhost4life. NOTE: I HAVE deployed other SQL Server sites to the same account with no issues. Now I'm getting...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.