SQL Network Interfaces, error: 26

A

AAaron123

I downloaded the personal website starter kit and when I run it I get the
error shown below.
I found a way of using Launch Surface Area Configuration that is supposed
to fix the remote setting but I tried it and still get the error.

I do not have SQL Server 2005 installed (thought I did once). I do have SQL
Server 2008 installed.

I don't see anywhere in the code where SQL Server 2005 is referenced.

Don't I have to tell in the code that I want to use SQL Server 2008?
Suppose I hade both on my machine?

Do I have some registry entry that did not get up dated from the 2005 to the
2008 versions?

Thanks for any help.



An error has occurred while establishing a connection to the server. When
connecting to SQL Server 2005, this failure may be caused by the fact that
under the default settings SQL Server does not allow remote connections.
(provider: SQL Network Interfaces, error: 26 - Error Locating
Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: An error has occurred
while establishing a connection to the server. When connecting to SQL
Server 2005, this failure may be caused by the fact that under the default
settings SQL Server does not allow remote connections. (provider: SQL
Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Source Error:

Line 194: Using command As New SqlCommand("GetNonEmptyAlbums", connection)
Line 195: command.CommandType = CommandType.StoredProcedure
Line 196: connection.Open()
Line 197: Dim list As New Generic.List(Of Album)()
Line 198: Using reader As SqlDataReader = command.ExecuteReader

Source File: I:\MyDocuments\Visual Studio
2008\WebSites\PersonalWebSite1\App_Code\PhotoManager.vb Line: 196
 
M

Michael Nemtsev [MVP]

Hello AAaron123,

Check the web.config, where should be the "connectionstring" attribute, where
they specify where to connect
of this can be somewhere in code

---
WBR,
Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


A> I downloaded the personal website starter kit and when I run it I get
A> the
A> error shown below.
A> I found a way of using Launch Surface Area Configuration that is
A> supposed
A> to fix the remote setting but I tried it and still get the error.
A> I do not have SQL Server 2005 installed (thought I did once). I do
A> have SQL Server 2008 installed.
A>
A> I don't see anywhere in the code where SQL Server 2005 is referenced.
A>
A> Don't I have to tell in the code that I want to use SQL Server 2008?
A> Suppose I hade both on my machine?
A>
A> Do I have some registry entry that did not get up dated from the 2005
A> to the 2008 versions?
A>
A> Thanks for any help.
A>
A> An error has occurred while establishing a connection to the server.
A> When
A> connecting to SQL Server 2005, this failure may be caused by the fact
A> that
A> under the default settings SQL Server does not allow remote
A> connections.
A> (provider: SQL Network Interfaces, error: 26 - Error Locating
A> Server/Instance Specified)
A> Description: An unhandled exception occurred during the execution of
A> the
A> current web request. Please review the stack trace for more
A> information
A> about the error and where it originated in the code.
A> Exception Details: System.Data.SqlClient.SqlException: An error has
A> occurred while establishing a connection to the server. When
A> connecting to SQL Server 2005, this failure may be caused by the fact
A> that under the default settings SQL Server does not allow remote
A> connections. (provider: SQL Network Interfaces, error: 26 - Error
A> Locating Server/Instance Specified)
A>
A> Source Error:
A>
A> Line 194: Using command As New SqlCommand("GetNonEmptyAlbums",
A> connection)
A> Line 195: command.CommandType = CommandType.StoredProcedure
A> Line 196: connection.Open()
A> Line 197: Dim list As New Generic.List(Of Album)()
A> Line 198: Using reader As SqlDataReader = command.ExecuteReader
A> Source File: I:\MyDocuments\Visual Studio
A> 2008\WebSites\PersonalWebSite1\App_Code\PhotoManager.vb Line: 196
A>
 
A

AAaron123

I do have SQL Server 2005 installed.
I previously had SQL Server 2008 Express installed.

I downloaded the personal website starter kit and when I run it I get the
error shown below.

I found a way of using Launch Surface Area Configuration that is supposed
to fix the remote setting but I tried it and still get the error.

I don't see anywhere in the code where SQL Server 2005 is referenced.

Don't I have to tell in the code that I want to use SQL Server 2005?
Suppose I hade mutilple versions on my machine?

Do I have some registry entry that did not get up dated from the 2008
express
to the 2005 versions?

Thanks for any help.



An error has occurred while establishing a connection to the server. When
connecting to SQL Server 2005, this failure may be caused by the fact that
under the default settings SQL Server does not allow remote connections.
(provider: SQL Network Interfaces, error: 26 - Error Locating
Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: An error has
occurred
while establishing a connection to the server. When connecting to SQL
Server 2005, this failure may be caused by the fact that under the default
settings SQL Server does not allow remote connections. (provider: SQL
Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Source Error:

Line 194: Using command As New SqlCommand("GetNonEmptyAlbums", connection)
Line 195: command.CommandType = CommandType.StoredProcedure
Line 196: connection.Open()
Line 197: Dim list As New Generic.List(Of Album)()
Line 198: Using reader As SqlDataReader = command.ExecuteReader

Source File: I:\MyDocuments\Visual Studio
2008\WebSites\PersonalWebSite1\App_Code\PhotoManager.vb Line: 196
 
B

bruce barker

the error means the sqlserver specified in the connection string was not
found. if you had both sqlserver 2005 & 2008, the 2008 is probably not the
default instance. either specify the instance, or create a new default
instance (reinstall sqlserver 2008)

-- bruce (sqlwork.com)
 
A

AAaron123

I find two such strings as shown below.

I see now that who ever wrote this assumed it would be used with the Express
version.
How do I change it to point to the SQL Server2005?


Also, I do see the file Personal.mdf in the solution list of file names.
But I do not see the file aspnetdb.mdf there. Do you thing the program might
create it when it runs?

Finally, the error message mentioned SQL2005 as if it converted from the
Express to 2005 since that is what it found. If that's the case why didn't
it make the connection?

Very confusing!

Thanks for the help



....
<add name="Personal" connectionString="Data Source=.\SQLExpress;Integrated
Security=True;User
Instance=True;AttachDBFilename=|DataDirectory|Personal.mdf"
providerName="System.Data.SqlClient"/>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data
Source=.\SQLExpress;Integrated Security=True;User
Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"/>
</connectionStrings>



Michael Nemtsev said:
Hello AAaron123,

Check the web.config, where should be the "connectionstring" attribute,
where they specify where to connect
of this can be somewhere in code

---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

A> I downloaded the personal website starter kit and when I run it I get
A> the
A> error shown below.
A> I found a way of using Launch Surface Area Configuration that is
A> supposed
A> to fix the remote setting but I tried it and still get the error.
A> I do not have SQL Server 2005 installed (thought I did once). I do
A> have SQL Server 2008 installed.
A> A> I don't see anywhere in the code where SQL Server 2005 is
referenced.
A> A> Don't I have to tell in the code that I want to use SQL Server 2008?
A> Suppose I hade both on my machine?
A> A> Do I have some registry entry that did not get up dated from the
2005
A> to the 2008 versions?
A> A> Thanks for any help.
A> A> An error has occurred while establishing a connection to the server.
A> When
A> connecting to SQL Server 2005, this failure may be caused by the fact
A> that
A> under the default settings SQL Server does not allow remote
A> connections.
A> (provider: SQL Network Interfaces, error: 26 - Error Locating
A> Server/Instance Specified)
A> Description: An unhandled exception occurred during the execution of
A> the
A> current web request. Please review the stack trace for more
A> information
A> about the error and where it originated in the code.
A> Exception Details: System.Data.SqlClient.SqlException: An error has
A> occurred while establishing a connection to the server. When
A> connecting to SQL Server 2005, this failure may be caused by the fact
A> that under the default settings SQL Server does not allow remote
A> connections. (provider: SQL Network Interfaces, error: 26 - Error
A> Locating Server/Instance Specified)
A> A> Source Error:
A> A> Line 194: Using command As New SqlCommand("GetNonEmptyAlbums",
A> connection)
A> Line 195: command.CommandType = CommandType.StoredProcedure
A> Line 196: connection.Open()
A> Line 197: Dim list As New Generic.List(Of Album)()
A> Line 198: Using reader As SqlDataReader = command.ExecuteReader
A> Source File: I:\MyDocuments\Visual Studio
A> 2008\WebSites\PersonalWebSite1\App_Code\PhotoManager.vb Line: 196
A>
 
A

AAaron123

I'll ask you the same questions I asked Michael Nemtsev.

I find two such strings as shown below.

I see now that who ever wrote this assumed it would be used with the Express
version.
How do I change it to point to the SQL Server2005?


Also, I do see the file Personal.mdf in the solution list of file names.
But I do not see the file aspnetdb.mdf there. Do you thing the program might
create it when it runs?

Finally, the error message mentioned SQL2005 as if it converted from the
Express to 2005 since that is what it found. If that's the case why didn't
it make the connection?

Very confusing!

Thanks for the help
 
M

Michael Nemtsev [MVP]

Hello AAaron123,

".\SQLExpress" means that you are connecting to SQL Express server. It's
standard build-in name
If you want to connect to SQL Server (not express) you need to change this
line on "(local)".

Btw, if you have SQL Management Studio installed (install if you not) then
you cant check which sevices you have and their names)

Alternatively, you can use Server tabs in visual studio and it shows available
SQL server around you. After u connect to one of them in shows your connection
string in properties. You can copy paste that connection string into your
web.config

---
WBR,
Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


A> I find two such strings as shown below.
A>
A> I see now that who ever wrote this assumed it would be used with the
A> Express
A> version.
A> How do I change it to point to the SQL Server2005?
A> Also, I do see the file Personal.mdf in the solution list of file
A> names.
A> But I do not see the file aspnetdb.mdf there. Do you thing the
A> program might
A> create it when it runs?
A> Finally, the error message mentioned SQL2005 as if it converted from
A> the Express to 2005 since that is what it found. If that's the case
A> why didn't it make the connection?
A>
A> Very confusing!
A>
A> Thanks for the help
A>
A> ...
A> <add name="Personal" connectionString="Data
A> Source=.\SQLExpress;Integrated
A> Security=True;User
A> Instance=True;AttachDBFilename=|DataDirectory|Personal.mdf"
A> providerName="System.Data.SqlClient"/>
A> <remove name="LocalSqlServer"/>
A> <add name="LocalSqlServer" connectionString="Data
A> Source=.\SQLExpress;Integrated Security=True;User
A> Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"/>
A> </connectionStrings>
A> A>
Hello AAaron123,

Check the web.config, where should be the "connectionstring"
attribute,
where they specify where to connect
of this can be somewhere in code
---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we
miss it, but that it is too low and we reach it" (c) Michelangelo
A> I downloaded the personal website starter kit and when I run it I
get
A> the
A> error shown below.
A> I found a way of using Launch Surface Area Configuration that is
A> supposed
A> to fix the remote setting but I tried it and still get the error.
A> I do not have SQL Server 2005 installed (thought I did once). I do
A> have SQL Server 2008 installed.
A> A> I don't see anywhere in the code where SQL Server 2005 is
referenced.
A> A> Don't I have to tell in the code that I want to use SQL Server
2008?
A> Suppose I hade both on my machine?
A> A> Do I have some registry entry that did not get up dated from
the
2005
A> to the 2008 versions?
A> A> Thanks for any help.
A> A> An error has occurred while establishing a connection to the
server.
A> When
A> connecting to SQL Server 2005, this failure may be caused by the
fact
A> that
A> under the default settings SQL Server does not allow remote
A> connections.
A> (provider: SQL Network Interfaces, error: 26 - Error Locating
A> Server/Instance Specified)
A> Description: An unhandled exception occurred during the execution
of
A> the
A> current web request. Please review the stack trace for more
A> information
A> about the error and where it originated in the code.
A> Exception Details: System.Data.SqlClient.SqlException: An error
has
A> occurred while establishing a connection to the server. When
A> connecting to SQL Server 2005, this failure may be caused by the
fact
A> that under the default settings SQL Server does not allow remote
A> connections. (provider: SQL Network Interfaces, error: 26 - Error
A> Locating Server/Instance Specified)
A> A> Source Error:
A> A> Line 194: Using command As New SqlCommand("GetNonEmptyAlbums",
A> connection)
A> Line 195: command.CommandType = CommandType.StoredProcedure
A> Line 196: connection.Open()
A> Line 197: Dim list As New Generic.List(Of Album)()
A> Line 198: Using reader As SqlDataReader = command.ExecuteReader
A> Source File: I:\MyDocuments\Visual Studio
A> 2008\WebSites\PersonalWebSite1\App_Code\PhotoManager.vb Line:
196
A>
 
B

bruce barker

a mdf file is a detached database. to create one you create a database
in sqlserver, then detach it (via a sql command).

in the connect string you can specify a mdf to auto attach which is
useful for simple sites. you can upload the database then attach on the
first connect.

from a programs point of view there is no difference between sqlexpress
and sqlserver 2005. only the license is different, and the tools
supplied.

to connect to a sqlserver you need to know the server its on and the
instance name. this is specified in the connect string, along with
default database, and an attach command if desired.

if you have sql2005, then run the management studio and browse for
sqlservers. this will list the instance names.


read the docs on sqlserver connect strings

-- bruce (sqlwork.com)
 
A

AAaron123

Michael Nemtsev said:
Hello AAaron123,

".\SQLExpress" means that you are connecting to SQL Express server. It's
standard build-in name
If you want to connect to SQL Server (not express) you need to change this
line on "(local)".

Btw, if you have SQL Management Studio installed (install if you not) then
you cant check which sevices you have and their names)


The default instance is unnamed and is shown as the computer name.
How do I reference that in the
connectionString="Data Source=

thanks for staying with me
Alternatively, you can use Server tabs in visual studio and it shows
available SQL server around you. After u connect to one of them in shows
your connection string in properties. You can copy paste that connection
string into your web.config

---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

A> I find two such strings as shown below.
A> A> I see now that who ever wrote this assumed it would be used with the
A> Express
A> version.
A> How do I change it to point to the SQL Server2005?
A> Also, I do see the file Personal.mdf in the solution list of file
A> names.
A> But I do not see the file aspnetdb.mdf there. Do you thing the
A> program might
A> create it when it runs?
A> Finally, the error message mentioned SQL2005 as if it converted from
A> the Express to 2005 since that is what it found. If that's the case
A> why didn't it make the connection?
A> A> Very confusing!
A> A> Thanks for the help
A> A> ...
A> <add name="Personal" connectionString="Data
A> Source=.\SQLExpress;Integrated
A> Security=True;User
A> Instance=True;AttachDBFilename=|DataDirectory|Personal.mdf"
A> providerName="System.Data.SqlClient"/>
A> <remove name="LocalSqlServer"/>
A> <add name="LocalSqlServer" connectionString="Data
A> Source=.\SQLExpress;Integrated Security=True;User
A> Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"/>
A> </connectionStrings>
A> A>
Hello AAaron123,

Check the web.config, where should be the "connectionstring"
attribute,
where they specify where to connect
of this can be somewhere in code
---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we
miss it, but that it is too low and we reach it" (c) Michelangelo
A> I downloaded the personal website starter kit and when I run it I
get
A> the
A> error shown below.
A> I found a way of using Launch Surface Area Configuration that is
A> supposed
A> to fix the remote setting but I tried it and still get the error.
A> I do not have SQL Server 2005 installed (thought I did once). I do
A> have SQL Server 2008 installed.
A> A> I don't see anywhere in the code where SQL Server 2005 is
referenced.
A> A> Don't I have to tell in the code that I want to use SQL Server
2008?
A> Suppose I hade both on my machine?
A> A> Do I have some registry entry that did not get up dated from
the
2005
A> to the 2008 versions?
A> A> Thanks for any help.
A> A> An error has occurred while establishing a connection to the
server.
A> When
A> connecting to SQL Server 2005, this failure may be caused by the
fact
A> that
A> under the default settings SQL Server does not allow remote
A> connections.
A> (provider: SQL Network Interfaces, error: 26 - Error Locating
A> Server/Instance Specified)
A> Description: An unhandled exception occurred during the execution
of
A> the
A> current web request. Please review the stack trace for more
A> information
A> about the error and where it originated in the code.
A> Exception Details: System.Data.SqlClient.SqlException: An error
has
A> occurred while establishing a connection to the server. When
A> connecting to SQL Server 2005, this failure may be caused by the
fact
A> that under the default settings SQL Server does not allow remote
A> connections. (provider: SQL Network Interfaces, error: 26 - Error
A> Locating Server/Instance Specified)
A> A> Source Error:
A> A> Line 194: Using command As New SqlCommand("GetNonEmptyAlbums",
A> connection)
A> Line 195: command.CommandType = CommandType.StoredProcedure
A> Line 196: connection.Open()
A> Line 197: Dim list As New Generic.List(Of Album)()
A> Line 198: Using reader As SqlDataReader = command.ExecuteReader
A> Source File: I:\MyDocuments\Visual Studio
A> 2008\WebSites\PersonalWebSite1\App_Code\PhotoManager.vb Line:
196
A>
 
A

AAaron123

bruce barker said:
a mdf file is a detached database. to create one you create a database in
sqlserver, then detach it (via a sql command).

in the connect string you can specify a mdf to auto attach which is useful
for simple sites. you can upload the database then attach on the first
connect.

from a programs point of view there is no difference between sqlexpress
and sqlserver 2005. only the license is different, and the tools supplied.

to connect to a sqlserver you need to know the server its on and the
instance name. this is specified in the connect string, along with default
database, and an attach command if desired.

if you have sql2005, then run the management studio and browse for
sqlservers. this will list the instance names.



The default instance is unnamed and is shown as the computer name.
How do I reference that in the
connectionString="Data Source=

thanks for staying with me

read the docs on sqlserver connect strings

This helped using management studio
 
J

Juan T. Llibre

re:
!> How do I reference that in the connectionString="Data Source=

Use the same name which the SQL Server Service Manager shows.

You should have an icon for the SQL Server Service Manager in your Taskbar Tray.
Double click it...and use the exact name it shows.

If the service manager isn't running, run it from
"Start Menu", "Programs", "SQL Server", "Service Manager".
 
A

AAaron123

One of my earlier tries was to simply changed Data Source=./SQLExpress to
Data Source=./zz

where zz is the name SQL Server Service Manager shows which is just the
computer name followed by nothing else. Guess that's the way the default
instance is named.

That did not work but when I removed the .\ it worked.

What does the dot stand for?



What if I run the program on another machine? Maybe using just the dot means
use the default instance. I'll try that now to see if it works. Comment?



I also had to remove User Instance=True which I guess is unique to the
Express version. Read the help but still don't know if removing will bite me
later. Think so?



SQL Server Service Manager Studio does not appear in my Taskbar tray when
it's running. Maybe there's an option I have to find for that to happen.

Thanks a lot
 
M

Michael Nemtsev [MVP]

Hello AAaron123,

Just specify you PC name in the connection string
instead of "Data Source=.\SQLExpress;
use "Data Source=YOUPCNAME;

---
WBR,
Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


A> A> A> The default instance is unnamed and is shown as the computer name.
A> How do I reference that in the
A> connectionString="Data Source=
A> thanks for staying with me
A>
Alternatively, you can use Server tabs in visual studio and it shows
available SQL server around you. After u connect to one of them in
shows your connection string in properties. You can copy paste that
connection string into your web.config

---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we
miss it, but that it is too low and we reach it" (c) Michelangelo
A> I find two such strings as shown below.
A> A> I see now that who ever wrote this assumed it would be used
with the
A> Express
A> version.
A> How do I change it to point to the SQL Server2005?
A> Also, I do see the file Personal.mdf in the solution list of file
A> names.
A> But I do not see the file aspnetdb.mdf there. Do you thing the
A> program might
A> create it when it runs?
A> Finally, the error message mentioned SQL2005 as if it converted
from
A> the Express to 2005 since that is what it found. If that's the
case
A> why didn't it make the connection?
A> A> Very confusing!
A> A> Thanks for the help
A> A> ...
A> <add name="Personal" connectionString="Data
A> Source=.\SQLExpress;Integrated
A> Security=True;User
A> Instance=True;AttachDBFilename=|DataDirectory|Personal.mdf"
A> providerName="System.Data.SqlClient"/>
A> <remove name="LocalSqlServer"/>
A> <add name="LocalSqlServer" connectionString="Data
A> Source=.\SQLExpress;Integrated Security=True;User
A> Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"/>
A> </connectionStrings>
A> A>
Hello AAaron123,

Check the web.config, where should be the "connectionstring"
attribute,
where they specify where to connect
of this can be somewhere in code
---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we
miss it, but that it is too low and we reach it" (c) Michelangelo
A> I downloaded the personal website starter kit and when I run it
I
get
A> the
A> error shown below.
A> I found a way of using Launch Surface Area Configuration that
is
A> supposed
A> to fix the remote setting but I tried it and still get the
error.
A> I do not have SQL Server 2005 installed (thought I did once). I
do
A> have SQL Server 2008 installed.
A> A> I don't see anywhere in the code where SQL Server 2005 is
referenced.
A> A> Don't I have to tell in the code that I want to use SQL
Server
2008?
A> Suppose I hade both on my machine?
A> A> Do I have some registry entry that did not get up dated from
the
2005
A> to the 2008 versions?
A> A> Thanks for any help.
A> A> An error has occurred while establishing a connection to the
server.
A> When
A> connecting to SQL Server 2005, this failure may be caused by the
fact
A> that
A> under the default settings SQL Server does not allow remote
A> connections.
A> (provider: SQL Network Interfaces, error: 26 - Error Locating
A> Server/Instance Specified)
A> Description: An unhandled exception occurred during the
execution
of
A> the
A> current web request. Please review the stack trace for more
A> information
A> about the error and where it originated in the code.
A> Exception Details: System.Data.SqlClient.SqlException: An error
has
A> occurred while establishing a connection to the server. When
A> connecting to SQL Server 2005, this failure may be caused by the
fact
A> that under the default settings SQL Server does not allow remote
A> connections. (provider: SQL Network Interfaces, error: 26 -
Error
A> Locating Server/Instance Specified)
A> A> Source Error:
A> A> Line 194: Using command As New
SqlCommand("GetNonEmptyAlbums",
A> connection)
A> Line 195: command.CommandType = CommandType.StoredProcedure
A> Line 196: connection.Open()
A> Line 197: Dim list As New Generic.List(Of Album)()
A> Line 198: Using reader As SqlDataReader = command.ExecuteReader
A> Source File: I:\MyDocuments\Visual Studio
A> 2008\WebSites\PersonalWebSite1\App_Code\PhotoManager.vb Line:
196
A>
 
A

AAaron123

That works!

But now the code will only run on my machine (I assume).
"Data Source=.; also appears to work.
Will that use the default instance on any machine the code is loaded on?


How do people prepare code to work on multiple machines without hard coding
for the default instance?

Thanks


Michael Nemtsev said:
Hello AAaron123,

Just specify you PC name in the connection string
instead of "Data Source=.\SQLExpress;
use "Data Source=YOUPCNAME;

---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

A> A>A> The default instance is unnamed and is shown as the computer name.
A> How do I reference that in the
A> connectionString="Data Source=
A> thanks for staying with me
A>
Alternatively, you can use Server tabs in visual studio and it shows
available SQL server around you. After u connect to one of them in
shows your connection string in properties. You can copy paste that
connection string into your web.config

---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we
miss it, but that it is too low and we reach it" (c) Michelangelo
A> I find two such strings as shown below.
A> A> I see now that who ever wrote this assumed it would be used
with the
A> Express
A> version.
A> How do I change it to point to the SQL Server2005?
A> Also, I do see the file Personal.mdf in the solution list of file
A> names.
A> But I do not see the file aspnetdb.mdf there. Do you thing the
A> program might
A> create it when it runs?
A> Finally, the error message mentioned SQL2005 as if it converted
from
A> the Express to 2005 since that is what it found. If that's the
case
A> why didn't it make the connection?
A> A> Very confusing!
A> A> Thanks for the help
A> A> ...
A> <add name="Personal" connectionString="Data
A> Source=.\SQLExpress;Integrated
A> Security=True;User
A> Instance=True;AttachDBFilename=|DataDirectory|Personal.mdf"
A> providerName="System.Data.SqlClient"/>
A> <remove name="LocalSqlServer"/>
A> <add name="LocalSqlServer" connectionString="Data
A> Source=.\SQLExpress;Integrated Security=True;User
A> Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"/>
A> </connectionStrings>
A> A>
Hello AAaron123,

Check the web.config, where should be the "connectionstring"
attribute,
where they specify where to connect
of this can be somewhere in code
---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we
miss it, but that it is too low and we reach it" (c) Michelangelo
A> I downloaded the personal website starter kit and when I run it
I
get
A> the
A> error shown below.
A> I found a way of using Launch Surface Area Configuration that
is
A> supposed
A> to fix the remote setting but I tried it and still get the
error.
A> I do not have SQL Server 2005 installed (thought I did once). I
do
A> have SQL Server 2008 installed.
A> A> I don't see anywhere in the code where SQL Server 2005 is
referenced.
A> A> Don't I have to tell in the code that I want to use SQL
Server
2008?
A> Suppose I hade both on my machine?
A> A> Do I have some registry entry that did not get up dated from
the
2005
A> to the 2008 versions?
A> A> Thanks for any help.
A> A> An error has occurred while establishing a connection to the
server.
A> When
A> connecting to SQL Server 2005, this failure may be caused by the
fact
A> that
A> under the default settings SQL Server does not allow remote
A> connections.
A> (provider: SQL Network Interfaces, error: 26 - Error Locating
A> Server/Instance Specified)
A> Description: An unhandled exception occurred during the
execution
of
A> the
A> current web request. Please review the stack trace for more
A> information
A> about the error and where it originated in the code.
A> Exception Details: System.Data.SqlClient.SqlException: An error
has
A> occurred while establishing a connection to the server. When
A> connecting to SQL Server 2005, this failure may be caused by the
fact
A> that under the default settings SQL Server does not allow remote
A> connections. (provider: SQL Network Interfaces, error: 26 -
Error
A> Locating Server/Instance Specified)
A> A> Source Error:
A> A> Line 194: Using command As New
SqlCommand("GetNonEmptyAlbums",
A> connection)
A> Line 195: command.CommandType = CommandType.StoredProcedure
A> Line 196: connection.Open()
A> Line 197: Dim list As New Generic.List(Of Album)()
A> Line 198: Using reader As SqlDataReader = command.ExecuteReader
A> Source File: I:\MyDocuments\Visual Studio
A> 2008\WebSites\PersonalWebSite1\App_Code\PhotoManager.vb Line:
196
A>
 
J

Juan T. Llibre

re:
!> "Data Source=.; also appears to work.

Indeed, because the dot ( . ) signifies the default instance.

re:
!> Will that use the default instance on any machine the code is loaded on?

Yes, but remember that not all instances are default instances.
Some are *named* instances.

In the case of the SQL Express named instance ( Data Source=.\SQLExpress )
what happens is that SQLExpress is the default name used for its named instance.

So, the dot ( . ) plus the default named instance, creates the full name for the named instance.

For SQL Server 2000, it's the same.

You can use the dot for the default instance, which equates to the machine's name,
but most installations create a named instance which needs to be added in order to
get a fully qualified instance name.





AAaron123 said:
That works!

But now the code will only run on my machine (I assume).
"Data Source=.; also appears to work.
Will that use the default instance on any machine the code is loaded on?


How do people prepare code to work on multiple machines without hard coding for the default instance?

Thanks


Michael Nemtsev said:
Hello AAaron123,

Just specify you PC name in the connection string
instead of "Data Source=.\SQLExpress;
use "Data Source=YOUPCNAME;

---
WBR, Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we
reach it" (c) Michelangelo

A> A>
Hello AAaron123,

".\SQLExpress" means that you are connecting to SQL Express server.
It's
standard build-in name
If you want to connect to SQL Server (not express) you need to change
this
line on "(local)".
Btw, if you have SQL Management Studio installed (install if you not)
then you cant check which sevices you have and their names)
A> The default instance is unnamed and is shown as the computer name.
A> How do I reference that in the
A> connectionString="Data Source=
A> thanks for staying with me
A>
Alternatively, you can use Server tabs in visual studio and it shows
available SQL server around you. After u connect to one of them in
shows your connection string in properties. You can copy paste that
connection string into your web.config

---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we
miss it, but that it is too low and we reach it" (c) Michelangelo
A> I find two such strings as shown below.
A> A> I see now that who ever wrote this assumed it would be used
with the
A> Express
A> version.
A> How do I change it to point to the SQL Server2005?
A> Also, I do see the file Personal.mdf in the solution list of file
A> names.
A> But I do not see the file aspnetdb.mdf there. Do you thing the
A> program might
A> create it when it runs?
A> Finally, the error message mentioned SQL2005 as if it converted
from
A> the Express to 2005 since that is what it found. If that's the
case
A> why didn't it make the connection?
A> A> Very confusing!
A> A> Thanks for the help
A> A> ...
A> <add name="Personal" connectionString="Data
A> Source=.\SQLExpress;Integrated
A> Security=True;User
A> Instance=True;AttachDBFilename=|DataDirectory|Personal.mdf"
A> providerName="System.Data.SqlClient"/>
A> <remove name="LocalSqlServer"/>
A> <add name="LocalSqlServer" connectionString="Data
A> Source=.\SQLExpress;Integrated Security=True;User
A> Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"/>
A> </connectionStrings>
A> A>
Hello AAaron123,

Check the web.config, where should be the "connectionstring"
attribute,
where they specify where to connect
of this can be somewhere in code
---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we
miss it, but that it is too low and we reach it" (c) Michelangelo
A> I downloaded the personal website starter kit and when I run it
I
get
A> the
A> error shown below.
A> I found a way of using Launch Surface Area Configuration that
is
A> supposed
A> to fix the remote setting but I tried it and still get the
error.
A> I do not have SQL Server 2005 installed (thought I did once). I
do
A> have SQL Server 2008 installed.
A> A> I don't see anywhere in the code where SQL Server 2005 is
referenced.
A> A> Don't I have to tell in the code that I want to use SQL
Server
2008?
A> Suppose I hade both on my machine?
A> A> Do I have some registry entry that did not get up dated from
the
2005
A> to the 2008 versions?
A> A> Thanks for any help.
A> A> An error has occurred while establishing a connection to the
server.
A> When
A> connecting to SQL Server 2005, this failure may be caused by the
fact
A> that
A> under the default settings SQL Server does not allow remote
A> connections.
A> (provider: SQL Network Interfaces, error: 26 - Error Locating
A> Server/Instance Specified)
A> Description: An unhandled exception occurred during the
execution
of
A> the
A> current web request. Please review the stack trace for more
A> information
A> about the error and where it originated in the code.
A> Exception Details: System.Data.SqlClient.SqlException: An error
has
A> occurred while establishing a connection to the server. When
A> connecting to SQL Server 2005, this failure may be caused by the
fact
A> that under the default settings SQL Server does not allow remote
A> connections. (provider: SQL Network Interfaces, error: 26 -
Error
A> Locating Server/Instance Specified)
A> A> Source Error:
A> A> Line 194: Using command As New
SqlCommand("GetNonEmptyAlbums",
A> connection)
A> Line 195: command.CommandType = CommandType.StoredProcedure
A> Line 196: connection.Open()
A> Line 197: Dim list As New Generic.List(Of Album)()
A> Line 198: Using reader As SqlDataReader = command.ExecuteReader
A> Source File: I:\MyDocuments\Visual Studio
A> 2008\WebSites\PersonalWebSite1\App_Code\PhotoManager.vb Line:
196
A>
 
A

AAaron123

Thanks a lot
Juan T. Llibre said:
re:
!> "Data Source=.; also appears to work.

Indeed, because the dot ( . ) signifies the default instance.

re:
!> Will that use the default instance on any machine the code is loaded
on?

Yes, but remember that not all instances are default instances.
Some are *named* instances.

In the case of the SQL Express named instance ( Data Source=.\SQLExpress )
what happens is that SQLExpress is the default name used for its named
instance.

So, the dot ( . ) plus the default named instance, creates the full name
for the named instance.

For SQL Server 2000, it's the same.

You can use the dot for the default instance, which equates to the
machine's name,
but most installations create a named instance which needs to be added in
order to
get a fully qualified instance name.





AAaron123 said:
That works!

But now the code will only run on my machine (I assume).
"Data Source=.; also appears to work.
Will that use the default instance on any machine the code is loaded on?


How do people prepare code to work on multiple machines without hard
coding for the default instance?

Thanks


Michael Nemtsev said:
Hello AAaron123,

Just specify you PC name in the connection string
instead of "Data Source=.\SQLExpress;
use "Data Source=YOUPCNAME;

---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and
we miss it, but that it is too low and we reach it" (c) Michelangelo

A> A>
Hello AAaron123,

".\SQLExpress" means that you are connecting to SQL Express server.
It's
standard build-in name
If you want to connect to SQL Server (not express) you need to change
this
line on "(local)".
Btw, if you have SQL Management Studio installed (install if you not)
then you cant check which sevices you have and their names)

A> The default instance is unnamed and is shown as the computer name.
A> How do I reference that in the
A> connectionString="Data Source=
A> thanks for staying with me
A>
Alternatively, you can use Server tabs in visual studio and it shows
available SQL server around you. After u connect to one of them in
shows your connection string in properties. You can copy paste that
connection string into your web.config

---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we
miss it, but that it is too low and we reach it" (c) Michelangelo
A> I find two such strings as shown below.
A> A> I see now that who ever wrote this assumed it would be used
with the
A> Express
A> version.
A> How do I change it to point to the SQL Server2005?
A> Also, I do see the file Personal.mdf in the solution list of file
A> names.
A> But I do not see the file aspnetdb.mdf there. Do you thing the
A> program might
A> create it when it runs?
A> Finally, the error message mentioned SQL2005 as if it converted
from
A> the Express to 2005 since that is what it found. If that's the
case
A> why didn't it make the connection?
A> A> Very confusing!
A> A> Thanks for the help
A> A> ...
A> <add name="Personal" connectionString="Data
A> Source=.\SQLExpress;Integrated
A> Security=True;User
A> Instance=True;AttachDBFilename=|DataDirectory|Personal.mdf"
A> providerName="System.Data.SqlClient"/>
A> <remove name="LocalSqlServer"/>
A> <add name="LocalSqlServer" connectionString="Data
A> Source=.\SQLExpress;Integrated Security=True;User
A> Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"/>
A> </connectionStrings>
A> A>
Hello AAaron123,

Check the web.config, where should be the "connectionstring"
attribute,
where they specify where to connect
of this can be somewhere in code
---
WBR, Michael Nemtsev [Microsoft MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we
miss it, but that it is too low and we reach it" (c) Michelangelo
A> I downloaded the personal website starter kit and when I run it
I
get
A> the
A> error shown below.
A> I found a way of using Launch Surface Area Configuration that
is
A> supposed
A> to fix the remote setting but I tried it and still get the
error.
A> I do not have SQL Server 2005 installed (thought I did once). I
do
A> have SQL Server 2008 installed.
A> A> I don't see anywhere in the code where SQL Server 2005 is
referenced.
A> A> Don't I have to tell in the code that I want to use SQL
Server
2008?
A> Suppose I hade both on my machine?
A> A> Do I have some registry entry that did not get up dated from
the
2005
A> to the 2008 versions?
A> A> Thanks for any help.
A> A> An error has occurred while establishing a connection to the
server.
A> When
A> connecting to SQL Server 2005, this failure may be caused by the
fact
A> that
A> under the default settings SQL Server does not allow remote
A> connections.
A> (provider: SQL Network Interfaces, error: 26 - Error Locating
A> Server/Instance Specified)
A> Description: An unhandled exception occurred during the
execution
of
A> the
A> current web request. Please review the stack trace for more
A> information
A> about the error and where it originated in the code.
A> Exception Details: System.Data.SqlClient.SqlException: An error
has
A> occurred while establishing a connection to the server. When
A> connecting to SQL Server 2005, this failure may be caused by the
fact
A> that under the default settings SQL Server does not allow remote
A> connections. (provider: SQL Network Interfaces, error: 26 -
Error
A> Locating Server/Instance Specified)
A> A> Source Error:
A> A> Line 194: Using command As New
SqlCommand("GetNonEmptyAlbums",
A> connection)
A> Line 195: command.CommandType = CommandType.StoredProcedure
A> Line 196: connection.Open()
A> Line 197: Dim list As New Generic.List(Of Album)()
A> Line 198: Using reader As SqlDataReader = command.ExecuteReader
A> Source File: I:\MyDocuments\Visual Studio
A> 2008\WebSites\PersonalWebSite1\App_Code\PhotoManager.vb Line:
196
A>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,516
Members
44,983
Latest member
BuyX10BoostKeto

Latest Threads

Top