dbTalk Databases Forums  

About sqlserver express connections.

comp.databases comp.databases


Discuss About sqlserver express connections. in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Liu Wei
 
Posts: n/a

Default About sqlserver express connections. - 11-16-2006 , 09:05 PM






I download sqlserver 2005 express,setup it with all default params. Then I
create a database "pubs",a table "table1" in "pubs".

After these steps,I try to open the connection with the following csharp
codes:

namespace TCLearn
{
class Program
{

static void Main(string[] args)
{
SqlConnection conn =
new SqlConnection("Server=LocalHost;Integrated
Security=SSPI;Database=pubs");
conn.Open();

}
}
}

Then I got the following exception:

Unhandled Exception: System.Data.SqlClient.SqlException: An error has
occurred while establishing a connection to the server. When connecting to
SQL Server 2
005, this failure may be caused by the fact that under the default settings
SQL Server does not allow remote connections. (provider: Named Pipes
Provider, err
or: 40 - Could not open a connection to SQL Server)
at System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException
exception, Boolean breakConnection)
at
System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject
stateObj)
at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner,
Boolean& failoverDemandDone, String host, String failoverPartner, String
protocol,
SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt,
Boolean trustServerCert, Boolean integratedSecurity, SqlConnection
owningObject, Boo
lean aliasLookup)
at
System.Data.SqlClient.SqlInternalConnectionTds.Ope nLoginEnlist(SqlConnection
owningObject, SqlConnectionString connectionOptions, String newPassword, Bo
olean redirectedUserInstance)
at
System.Data.SqlClient.SqlInternalConnectionTds..ct or(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo, Stri
ng newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at
System.Data.SqlClient.SqlConnectionFactory.CreateC onnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnecti
on owningConnection)
at
System.Data.ProviderBase.DbConnectionFactory.Creat ePooledConnection(DbConnection
owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateOb ject(DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionPool.UserCrea teRequest(DbConnection
owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at TCLearn.Program.Main(String[] args) in F:\lr\TCLearn\Program.cs:line
46

What's the problem? Thank you.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.