Hello, I'm attempting to migrate a website to a new hosting provider. The site uses ASP 2 with an MSSQL database. I'm setting it up on a virtual dedicated server with goDaddy, so I have complete control over all of the settings. I've installed MSSQL Studio 2005 Express along with the Management Studio. I've setup the database server, restored the relevant database, created the necessary users, and modified the login info in the web.config file to reflect the changes. When I access the server via ip in my web browser and try to view index.aspx in the root web directory, I'm given this error: Cannot open database "BDC\SQLEXPRESS" requested by the login. The login failed. Login failed for user '[username]'. 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: Cannot open database "BDC\SQLEXPRESS" requested by the login. The login failed. Login failed for user '[username]'. Source Error: Line 50: myConnection = New SqlConnection(ConfigurationSettings.AppSettings("connName")) Line 51: myCommand = New SqlCommand(pressSQL, myConnection) Line 52: myConnection.Open() Line 53: Line 54: myPR.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection) Source File: [index.aspx] Line: 52 Stack Trace: [SqlException (0x80131904): Cannot open database "BDC\SQLEXPRESS" requested by the login. The login failed. Login failed for user '[username]'.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734995 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.SqlClient.SqlConnection.Open() +111 ASP.include_incpresshome_ascx.BindPressData() in C:\Inetpub\vhosts\baltimoredevelopment.com\httpdocs\include\incPressHome.ascx:52 ASP.include_incpresshome_ascx.Page_Load(Object sender, EventArgs e) in C:\Inetpub\vhosts\baltimoredevelopment.com\httpdocs\include\incPressHome.ascx:8 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45 System.Web.UI.Control.OnLoad(EventArgs e) +98 System.Web.UI.Control.LoadRecursive() +71 System.Web.UI.Control.LoadRecursive() +154 System.Web.UI.Control.LoadRecursive() +154 System.Web.UI.Control.LoadRecursive() +154 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4315 Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42 Code (markup): I'm using the same user name and password combination that I use to login through MSSQL Management Studio. I've also tried every conceivable combination of servername, [machinename\servername, username, [machinename]\username, etc. Here are some of the things that I've checked after reading various help articles: -The user logon that I am using has dbuser,dbwriter, and dbreader access to the relevant database. -I've set the database to allow Windows Authentication and SQL Authentication -The database server is set to allow remote connects for both tcp/ip and named pipes -port 1433 is open and all MSSQL software is set to use that port -I've tried adding users NT AUTHORITY\NETWORK SERVICES and [MACHINENAME]\ASPNET and giving them access to the relevant database -I've tried to add <identity impersonate="true" userName="[username]" password="[username]" /> to the web.config file to use a different authentication method The OS is Microsoft Server 2003. here's my web.config file: <?xml version="1.0" encoding="utf-8"?> <configuration> <connectionStrings> <add name="connName" connectionString="Data Source= localhost;Network Library=DBMSSOCN;Initial Catalog=BDC\SQLEXPRESS;User ID=[username];Password=[password]" /> </connectionStrings> <system.net> <mailSettings> <smtp from=""> <network host="" port="25" userName="" password="" defaultCredentials="true" /> </smtp> </mailSettings> </system.net> <appSettings> <add key="ConnName" value="Data Source=localhost;Network Library=DBMSSOCN;Initial Catalog=BDC\SQLEXPRESS;User ID=[username];Password=[password]" /> <add key="uploadPath" value="[filepath]" /> <add key="imagePath_upload" value="[filepath]" /> <add key="photouploadPath" value="[filepath]" /> <add key="photoPath_upload" value="[filepath]" /> <add key="imagepath" value="[filepath]" /> <add key="errorTo" value="[emailaddress]" /> <add key="errorFrom" value="[emailaddress]" /> <add key="defaultFrom" value="[emailaddress]" /> <add key="defaultTo" value="[emailaddress]" /> <add key="contactTo" value="[emailaddress]" /> <add key="infoTo" value="[emailaddress]" /> <add key="publicpath" value="[emailaddress]" /> <add key="mailServer" value="[mailservername]" /> </appSettings> <system.web> <pages validateRequest="false" /> <customErrors mode="Off"/> <compilation debug="true"/> </system.web> </configuration> Code (markup): Any help would be greatly appreciated. I'm totally out of ideas and my hosting provider is offering absolutely no support for the issue. I really need help. Thank you!
Initial Catalog should be name of the database , it is not BDC/SQLEXPRESS BDC/SQLEXPRESS is your sql server name If i assume correctly you must have created a database with some name and created sql logins using security. You should use those credentials.
<add name="SQLConnString" connectionString="Data Source=192.168.1.3,9167;Initial Catalog=database;User ID=usrname;Password=password;Connect Timeout=500 " providerName="System.Data.SqlClient"/> Initial Catalog is database name; you BDC\SQLEXPRESS=192.168.1.3,9167 is server name
use this connection string add name="connectionstring name" connectionstring="server=servername;datatbase=datatbase name;uid=sa(for sqlserver 2005 using sql authentication) mpwd=password)