Saturday, August 8, 2009

Sql DataBase connection with asp.net and vb.net?

I am trying to connect to a database with an asp.net page I am using a sql datasource control that has been supplied with visual studio. The Connection string is being stored in the web config file. The error that I am getting is after I have deployed the project and during runtime.



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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)



Source Error:



An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.



Stack Trace:



[SqlException (0x80131904): 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]



System.Data.SqlClient.SqlInternalConne... r(SqlException exception, Boolean breakConnection) +734963



System.Data.SqlClient.TdsParser.ThrowE... arning(TdsParserStateObject stateObj) +188



System.Data.SqlClient.TdsParser.Connec... useFailoverPartner, Boolean%26amp; failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +820



System.Data.SqlClient.SqlInternalConne... nLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628



System.Data.SqlClient.SqlInternalConne... or(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170



System.Data.SqlClient.SqlConnectionFac... onnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359



System.Data.ProviderBase.DbConnectionF... eNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +27



System.Data.ProviderBase.DbConnectionF... nnection(DbConnection owningConnection) +47



System.Data.ProviderBase.DbConnectionC... nnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105



System.Data.SqlClient.SqlConnection.Op... +111



System.Data.Common.DbDataAdapter.FillI... Set dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121



System.Data.Common.DbDataAdapter.Fill(... dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137



System.Data.Common.DbDataAdapter.Fill(... dataSet, String srcTable) +83



System.Web.UI.WebControls.SqlDataSourc... eSelect(DataSourceSelectArguments arguments) +1770



System.Web.UI.DataSourceView.Select(Da... ctArguments arguments, DataSourceViewSelectCallback callback) +17



DevExpress.Web.ASPxClasses.Internal.Da... formSelect() +190



DevExpress.Web.ASPxClasses.Internal.Da... PerformSelect() +118



DevExpress.Web.ASPxClasses.ASPxDataWeb... DataBindCore() +15



DevExpress.Web.ASPxClasses.ASPxDataWeb... DataBind() +108



DevExpress.Web.ASPxClasses.Internal.Da... .EnsureDataBound(Boolean ensureChildControls) +89



DevExpress.Web.ASPxClasses.Internal.Da... EnsureDataBound() +128



DevExpress.Web.ASPxDataView.ASPxDataVi... eChildControls() +15



System.Web.UI.Control.EnsureChildContr... +87



DevExpress.Web.ASPxClasses.ASPxWebCont... reChildControls() +4



System.Web.UI.Control.PreRenderRecursi... +41



System.Web.UI.Control.PreRenderRecursi... +161



System.Web.UI.Control.PreRenderRecursi... +161



System.Web.UI.Page.ProcessRequestMain(... includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360



Sql DataBase connection with asp.net and vb.net?





Open the SQL Server Configuration Manager



Go to the protocols under network configuration



Enable TCP/IP or Named pipes depending on how you talk to SQL.



Sql DataBase connection with asp.net and vb.net?



That%26#039;s because you database was not setup to accept remote connections.

1 comment:

  1. I was not known before about SQL database. Thanks a lot for sharing this I got to know much about it.
    Web Hosting

    ReplyDelete