By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,780 Members | 1,550 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,780 IT Pros & Developers. It's quick & easy.

SQL Network Interfaces, error: 26

P: n/a

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\PhotoManag er.vb Line: 196

Jul 17 '08 #1
Share this Question
Share on Google+
13 Replies


P: n/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
AI downloaded the personal website starter kit and when I run it I get
Athe
Aerror shown below.
AI found a way of using Launch Surface Area Configuration that is
Asupposed
Ato fix the remote setting but I tried it and still get the error.
AI do not have SQL Server 2005 installed (thought I did once). I do
Ahave SQL Server 2008 installed.
A>
AI don't see anywhere in the code where SQL Server 2005 is referenced.
A>
ADon't I have to tell in the code that I want to use SQL Server 2008?
ASuppose I hade both on my machine?
A>
ADo I have some registry entry that did not get up dated from the 2005
Ato the 2008 versions?
A>
AThanks for any help.
A>
AAn error has occurred while establishing a connection to the server.
AWhen
Aconnecting to SQL Server 2005, this failure may be caused by the fact
Athat
Aunder the default settings SQL Server does not allow remote
Aconnections.
A(provider: SQL Network Interfaces, error: 26 - Error Locating
AServer/Instance Specified)
ADescription: An unhandled exception occurred during the execution of
Athe
Acurrent web request. Please review the stack trace for more
Ainformation
Aabout the error and where it originated in the code.
AException Details: System.Data.SqlClient.SqlException: An error has
Aoccurred while establishing a connection to the server. When
Aconnecting to SQL Server 2005, this failure may be caused by the fact
Athat under the default settings SQL Server does not allow remote
Aconnections. (provider: SQL Network Interfaces, error: 26 - Error
ALocating Server/Instance Specified)
A>
ASource Error:
A>
ALine 194: Using command As New SqlCommand("GetNonEmptyAlbums",
Aconnection)
ALine 195: command.CommandType = CommandType.StoredProcedure
ALine 196: connection.Open()
ALine 197: Dim list As New Generic.List(Of Album)()
ALine 198: Using reader As SqlDataReader = command.ExecuteReader
ASource File: I:\MyDocuments\Visual Studio
A2008\WebSites\PersonalWebSite1\App_Code\PhotoMana ger.vb Line: 196
A>
Jul 17 '08 #2

P: n/a
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\PhotoManag er.vb Line: 196


Jul 17 '08 #3

P: n/a
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)
"AAaron123" wrote:
>
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\PhotoManag er.vb Line: 196

Jul 17 '08 #4

P: n/a
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|Pers onal.mdf"
providerName="System.Data.SqlClient"/>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data
Source=.\SQLExpress;Integrated Security=True;User
Instance=True;AttachDBFilename=|DataDirectory|aspn etdb.mdf"/>
</connectionStrings>

"Michael Nemtsev [MVP]" <ne*****@msn.comwrote in message
news:90**************************@msnews.microsoft .com...
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

AI downloaded the personal website starter kit and when I run it I get
Athe
Aerror shown below.
AI found a way of using Launch Surface Area Configuration that is
Asupposed
Ato fix the remote setting but I tried it and still get the error.
AI do not have SQL Server 2005 installed (thought I did once). I do
Ahave SQL Server 2008 installed.
AAI don't see anywhere in the code where SQL Server 2005 is
referenced.
AADon't I have to tell in the code that I want to use SQL Server 2008?
ASuppose I hade both on my machine?
AADo I have some registry entry that did not get up dated from the
2005
Ato the 2008 versions?
AAThanks for any help.
AAAn error has occurred while establishing a connection to the server.
AWhen
Aconnecting to SQL Server 2005, this failure may be caused by the fact
Athat
Aunder the default settings SQL Server does not allow remote
Aconnections.
A(provider: SQL Network Interfaces, error: 26 - Error Locating
AServer/Instance Specified)
ADescription: An unhandled exception occurred during the execution of
Athe
Acurrent web request. Please review the stack trace for more
Ainformation
Aabout the error and where it originated in the code.
AException Details: System.Data.SqlClient.SqlException: An error has
Aoccurred while establishing a connection to the server. When
Aconnecting to SQL Server 2005, this failure may be caused by the fact
Athat under the default settings SQL Server does not allow remote
Aconnections. (provider: SQL Network Interfaces, error: 26 - Error
ALocating Server/Instance Specified)
AASource Error:
AALine 194: Using command As New SqlCommand("GetNonEmptyAlbums",
Aconnection)
ALine 195: command.CommandType = CommandType.StoredProcedure
ALine 196: connection.Open()
ALine 197: Dim list As New Generic.List(Of Album)()
ALine 198: Using reader As SqlDataReader = command.ExecuteReader
ASource File: I:\MyDocuments\Visual Studio
A2008\WebSites\PersonalWebSite1\App_Code\PhotoMana ger.vb Line: 196
A>

Jul 18 '08 #5

P: n/a
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

"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:1A**********************************@microsof t.com...
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)
"AAaron123" wrote:
>>
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\PhotoMana ger.vb Line: 196


Jul 18 '08 #6

P: n/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)

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
AI find two such strings as shown below.
A>
AI see now that who ever wrote this assumed it would be used with the
AExpress
Aversion.
AHow do I change it to point to the SQL Server2005?
AAlso, I do see the file Personal.mdf in the solution list of file
Anames.
ABut I do not see the file aspnetdb.mdf there. Do you thing the
Aprogram might
Acreate it when it runs?
AFinally, the error message mentioned SQL2005 as if it converted from
Athe Express to 2005 since that is what it found. If that's the case
Awhy didn't it make the connection?
A>
AVery confusing!
A>
AThanks for the help
A>
A...
A<add name="Personal" connectionString="Data
ASource=.\SQLExpress;Integrated
ASecurity=True;User
AInstance=True;AttachDBFilename=|DataDirectory|Per sonal.mdf"
AproviderName="System.Data.SqlClient"/>
A<remove name="LocalSqlServer"/>
A<add name="LocalSqlServer" connectionString="Data
ASource=.\SQLExpress;Integrated Security=True;User
AInstance=True;AttachDBFilename=|DataDirectory|asp netdb.mdf"/>
A</connectionStrings>
A"Michael Nemtsev [MVP]" <ne*****@msn.comwrote in message
Anews:90**************************@msnews.microsof t.com...
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
AI downloaded the personal website starter kit and when I run it I
get
Athe
Aerror shown below.
AI found a way of using Launch Surface Area Configuration that is
Asupposed
Ato fix the remote setting but I tried it and still get the error.
AI do not have SQL Server 2005 installed (thought I did once). I do
Ahave SQL Server 2008 installed.
AAI don't see anywhere in the code where SQL Server 2005 is
referenced.
AADon't I have to tell in the code that I want to use SQL Server
2008?
ASuppose I hade both on my machine?
AADo I have some registry entry that did not get up dated from
the
2005
Ato the 2008 versions?
AAThanks for any help.
AAAn error has occurred while establishing a connection to the
server.
AWhen
Aconnecting to SQL Server 2005, this failure may be caused by the
fact
Athat
Aunder the default settings SQL Server does not allow remote
Aconnections.
A(provider: SQL Network Interfaces, error: 26 - Error Locating
AServer/Instance Specified)
ADescription: An unhandled exception occurred during the execution
of
Athe
Acurrent web request. Please review the stack trace for more
Ainformation
Aabout the error and where it originated in the code.
AException Details: System.Data.SqlClient.SqlException: An error
has
Aoccurred while establishing a connection to the server. When
Aconnecting to SQL Server 2005, this failure may be caused by the
fact
Athat under the default settings SQL Server does not allow remote
Aconnections. (provider: SQL Network Interfaces, error: 26 - Error
ALocating Server/Instance Specified)
AASource Error:
AALine 194: Using command As New SqlCommand("GetNonEmptyAlbums",
Aconnection)
ALine 195: command.CommandType = CommandType.StoredProcedure
ALine 196: connection.Open()
ALine 197: Dim list As New Generic.List(Of Album)()
ALine 198: Using reader As SqlDataReader = command.ExecuteReader
ASource File: I:\MyDocuments\Visual Studio
A2008\WebSites\PersonalWebSite1\App_Code\PhotoMan ager.vb Line:
196
A>

Jul 18 '08 #7

P: n/a
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)

AAaron123 wrote:
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

"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:1A**********************************@microsof t.com...
>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)
"AAaron123" wrote:
>>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\PhotoMan ager.vb Line: 196


Jul 18 '08 #8

P: n/a

"bruce barker" <no****@nospam.comwrote in message
news:e$**************@TK2MSFTNGP03.phx.gbl...
>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
>
-- bruce (sqlwork.com)

AAaron123 wrote:
>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

"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:1A**********************************@microso ft.com...
>>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)
"AAaron123" wrote:

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\PhotoMa nager.vb Line: 196

Jul 18 '08 #9

P: n/a


"Michael Nemtsev [MVP]" <ne*****@msn.comwrote in message
news:90**************************@msnews.microsoft .com...
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

AI find two such strings as shown below.
AAI see now that who ever wrote this assumed it would be used with the
AExpress
Aversion.
AHow do I change it to point to the SQL Server2005?
AAlso, I do see the file Personal.mdf in the solution list of file
Anames.
ABut I do not see the file aspnetdb.mdf there. Do you thing the
Aprogram might
Acreate it when it runs?
AFinally, the error message mentioned SQL2005 as if it converted from
Athe Express to 2005 since that is what it found. If that's the case
Awhy didn't it make the connection?
AAVery confusing!
AAThanks for the help
AA...
A<add name="Personal" connectionString="Data
ASource=.\SQLExpress;Integrated
ASecurity=True;User
AInstance=True;AttachDBFilename=|DataDirectory|Per sonal.mdf"
AproviderName="System.Data.SqlClient"/>
A<remove name="LocalSqlServer"/>
A<add name="LocalSqlServer" connectionString="Data
ASource=.\SQLExpress;Integrated Security=True;User
AInstance=True;AttachDBFilename=|DataDirectory|asp netdb.mdf"/>
A</connectionStrings>
A"Michael Nemtsev [MVP]" <ne*****@msn.comwrote in message
Anews:90**************************@msnews.microsof t.com...
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
AI downloaded the personal website starter kit and when I run it I
get
Athe
Aerror shown below.
AI found a way of using Launch Surface Area Configuration that is
Asupposed
Ato fix the remote setting but I tried it and still get the error.
AI do not have SQL Server 2005 installed (thought I did once). I do
Ahave SQL Server 2008 installed.
AAI don't see anywhere in the code where SQL Server 2005 is
referenced.
AADon't I have to tell in the code that I want to use SQL Server
2008?
ASuppose I hade both on my machine?
AADo I have some registry entry that did not get up dated from
the
2005
Ato the 2008 versions?
AAThanks for any help.
AAAn error has occurred while establishing a connection to the
server.
AWhen
Aconnecting to SQL Server 2005, this failure may be caused by the
fact
Athat
Aunder the default settings SQL Server does not allow remote
Aconnections.
A(provider: SQL Network Interfaces, error: 26 - Error Locating
AServer/Instance Specified)
ADescription: An unhandled exception occurred during the execution
of
Athe
Acurrent web request. Please review the stack trace for more
Ainformation
Aabout the error and where it originated in the code.
AException Details: System.Data.SqlClient.SqlException: An error
has
Aoccurred while establishing a connection to the server. When
Aconnecting to SQL Server 2005, this failure may be caused by the
fact
Athat under the default settings SQL Server does not allow remote
Aconnections. (provider: SQL Network Interfaces, error: 26 - Error
ALocating Server/Instance Specified)
AASource Error:
AALine 194: Using command As New SqlCommand("GetNonEmptyAlbums",
Aconnection)
ALine 195: command.CommandType = CommandType.StoredProcedure
ALine 196: connection.Open()
ALine 197: Dim list As New Generic.List(Of Album)()
ALine 198: Using reader As SqlDataReader = command.ExecuteReader
ASource File: I:\MyDocuments\Visual Studio
A2008\WebSites\PersonalWebSite1\App_Code\PhotoMa nager.vb Line:
196
A>


Jul 18 '08 #10

P: n/a
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".

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"AAaron123" <aa*******@roadrunner.comwrote in message news:eK**************@TK2MSFTNGP04.phx.gbl...
>
"bruce barker" <no****@nospam.comwrote in message news:e$**************@TK2MSFTNGP03.phx.gbl...
>>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
>>
-- bruce (sqlwork.com)

AAaron123 wrote:
>>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

"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:1A**********************************@micros oft.com...
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)
"AAaron123" wrote:

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\PhotoM anager.vb Line: 196
>
>
>
>

Jul 18 '08 #11

P: n/a
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
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:uE**************@TK2MSFTNGP05.phx.gbl...
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".

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"AAaron123" <aa*******@roadrunner.comwrote in message
news:eK**************@TK2MSFTNGP04.phx.gbl...
>>
"bruce barker" <no****@nospam.comwrote in message
news:e$**************@TK2MSFTNGP03.phx.gbl...
>>>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
>>>
-- bruce (sqlwork.com)

AAaron123 wrote:
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

"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:1A**********************************@micro soft.com...
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)
>
>
"AAaron123" wrote:
>
>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\Photo Manager.vb Line: 196
>>
>>
>>
>>


Jul 18 '08 #12

P: n/a
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"Michael Nemtsev [MVP]" <ne*****@msn.comwrote in message
Anews:90**************************@msnews.microsof t.com...
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)
AThe default instance is unnamed and is shown as the computer name.
AHow do I reference that in the
AconnectionString="Data Source=
Athanks 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
AI find two such strings as shown below.
AAI see now that who ever wrote this assumed it would be used
with the
AExpress
Aversion.
AHow do I change it to point to the SQL Server2005?
AAlso, I do see the file Personal.mdf in the solution list of file
Anames.
ABut I do not see the file aspnetdb.mdf there. Do you thing the
Aprogram might
Acreate it when it runs?
AFinally, the error message mentioned SQL2005 as if it converted
from
Athe Express to 2005 since that is what it found. If that's the
case
Awhy didn't it make the connection?
AAVery confusing!
AAThanks for the help
AA...
A<add name="Personal" connectionString="Data
ASource=.\SQLExpress;Integrated
ASecurity=True;User
AInstance=True;AttachDBFilename=|DataDirectory|Pe rsonal.mdf"
AproviderName="System.Data.SqlClient"/>
A<remove name="LocalSqlServer"/>
A<add name="LocalSqlServer" connectionString="Data
ASource=.\SQLExpress;Integrated Security=True;User
AInstance=True;AttachDBFilename=|DataDirectory|as pnetdb.mdf"/>
A</connectionStrings>
A"Michael Nemtsev [MVP]" <ne*****@msn.comwrote in message
Anews:90**************************@msnews.microso ft.com...
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
AI downloaded the personal website starter kit and when I run it
I
get
Athe
Aerror shown below.
AI found a way of using Launch Surface Area Configuration that
is
Asupposed
Ato fix the remote setting but I tried it and still get the
error.
AI do not have SQL Server 2005 installed (thought I did once). I
do
Ahave SQL Server 2008 installed.
AAI don't see anywhere in the code where SQL Server 2005 is
referenced.
AADon't I have to tell in the code that I want to use SQL
Server
2008?
ASuppose I hade both on my machine?
AADo I have some registry entry that did not get up dated from
the
2005
Ato the 2008 versions?
AAThanks for any help.
AAAn error has occurred while establishing a connection to the
server.
AWhen
Aconnecting to SQL Server 2005, this failure may be caused by the
fact
Athat
Aunder the default settings SQL Server does not allow remote
Aconnections.
A(provider: SQL Network Interfaces, error: 26 - Error Locating
AServer/Instance Specified)
ADescription: An unhandled exception occurred during the
execution
of
Athe
Acurrent web request. Please review the stack trace for more
Ainformation
Aabout the error and where it originated in the code.
AException Details: System.Data.SqlClient.SqlException: An error
has
Aoccurred while establishing a connection to the server. When
Aconnecting to SQL Server 2005, this failure may be caused by the
fact
Athat under the default settings SQL Server does not allow remote
Aconnections. (provider: SQL Network Interfaces, error: 26 -
Error
ALocating Server/Instance Specified)
AASource Error:
AALine 194: Using command As New
SqlCommand("GetNonEmptyAlbums",
Aconnection)
ALine 195: command.CommandType = CommandType.StoredProcedure
ALine 196: connection.Open()
ALine 197: Dim list As New Generic.List(Of Album)()
ALine 198: Using reader As SqlDataReader = command.ExecuteReader
ASource File: I:\MyDocuments\Visual Studio
A2008\WebSites\PersonalWebSite1\App_Code\PhotoM anager.vb Line:
196
A>

Jul 19 '08 #13

P: n/a
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 [MVP]" <ne*****@msn.comwrote in message
news:90**************************@msnews.microsoft .com...
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"Michael Nemtsev [MVP]" <ne*****@msn.comwrote in message
Anews:90**************************@msnews.microsof t.com...
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)
AThe default instance is unnamed and is shown as the computer name.
AHow do I reference that in the
AconnectionString="Data Source=
Athanks 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
AI find two such strings as shown below.
AAI see now that who ever wrote this assumed it would be used
with the
AExpress
Aversion.
AHow do I change it to point to the SQL Server2005?
AAlso, I do see the file Personal.mdf in the solution list of file
Anames.
ABut I do not see the file aspnetdb.mdf there. Do you thing the
Aprogram might
Acreate it when it runs?
AFinally, the error message mentioned SQL2005 as if it converted
from
Athe Express to 2005 since that is what it found. If that's the
case
Awhy didn't it make the connection?
AAVery confusing!
AAThanks for the help
AA...
A<add name="Personal" connectionString="Data
ASource=.\SQLExpress;Integrated
ASecurity=True;User
AInstance=True;AttachDBFilename=|DataDirectory|P ersonal.mdf"
AproviderName="System.Data.SqlClient"/>
A<remove name="LocalSqlServer"/>
A<add name="LocalSqlServer" connectionString="Data
ASource=.\SQLExpress;Integrated Security=True;User
AInstance=True;AttachDBFilename=|DataDirectory|a spnetdb.mdf"/>
A</connectionStrings>
A"Michael Nemtsev [MVP]" <ne*****@msn.comwrote in message
Anews:90**************************@msnews.micros oft.com...
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
AI downloaded the personal website starter kit and when I run it
I
get
Athe
Aerror shown below.
AI found a way of using Launch Surface Area Configuration that
is
Asupposed
Ato fix the remote setting but I tried it and still get the
error.
AI do not have SQL Server 2005 installed (thought I did once). I
do
Ahave SQL Server 2008 installed.
AAI don't see anywhere in the code where SQL Server 2005 is
referenced.
AADon't I have to tell in the code that I want to use SQL
Server
2008?
ASuppose I hade both on my machine?
AADo I have some registry entry that did not get up dated from
the
2005
Ato the 2008 versions?
AAThanks for any help.
AAAn error has occurred while establishing a connection to the
server.
AWhen
Aconnecting to SQL Server 2005, this failure may be caused by the
fact
Athat
Aunder the default settings SQL Server does not allow remote
Aconnections.
A(provider: SQL Network Interfaces, error: 26 - Error Locating
AServer/Instance Specified)
ADescription: An unhandled exception occurred during the
execution
of
Athe
Acurrent web request. Please review the stack trace for more
Ainformation
Aabout the error and where it originated in the code.
AException Details: System.Data.SqlClient.SqlException: An error
has
Aoccurred while establishing a connection to the server. When
Aconnecting to SQL Server 2005, this failure may be caused by the
fact
Athat under the default settings SQL Server does not allow remote
Aconnections. (provider: SQL Network Interfaces, error: 26 -
Error
ALocating Server/Instance Specified)
AASource Error:
AALine 194: Using command As New
SqlCommand("GetNonEmptyAlbums",
Aconnection)
ALine 195: command.CommandType = CommandType.StoredProcedure
ALine 196: connection.Open()
ALine 197: Dim list As New Generic.List(Of Album)()
ALine 198: Using reader As SqlDataReader = command.ExecuteReader
ASource File: I:\MyDocuments\Visual Studio
A2008\WebSites\PersonalWebSite1\App_Code\Photo Manager.vb Line:
196
A>


Jul 19 '08 #14

This discussion thread is closed

Replies have been disabled for this discussion.