Hi all.
I am working on asp.net 2.0 with back end as sqlserver 2000. but when trying to connect to the database i am getting the following error displayed
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)
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: 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.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +115
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +346
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, Boolean aliasLookup) +1093
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +1083
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +272
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +351
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +82
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +558
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +126
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +651
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +160
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +122
System.Data.SqlClient.SqlConnection.Open() +229
System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +114
System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +225
System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +1105
System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +157
System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +68
System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +100
System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +100
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +113
System.Web.UI.WebControls.Login.AttemptLogin() +178
System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +134
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +107
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +178
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3837
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42can anyone help???????????
regards
pravallika
![]() |
0 |
![]() |
Check the provider - you probably need to use "Microsoft OLE DB Provider for SQL Server" as the default is the provider for SQL2005 (SQL Native client?).
Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
![]() |
0 |
![]() |
Error itself say what is the problem. You need to allow SQL server to accept remote connection
Everything is possible!
![]() |
0 |
![]() |
i have same problem any know the answer
Nothing is really over,untill the moment stop trying for it...
Amitsp(MCTS,MCP)
sqlreporting.blogspot.com
![]() |
0 |
![]() |
Have you done setting in SQL 2005 to allow remote connection?
Everything is possible!
![]() |
0 |
![]() |
As the backend database is SQ:2000 not SQL2005, the hint from the error message is mis-leading!
Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
![]() |
0 |
![]() |
Try this http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277
Everything is possible!
![]() |
0 |
![]() |
Could you please give connection string?
Everything is possible!
![]() |
0 |
![]() |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace timepass
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Target database, empty, with one table
System.Data.DataSet dsTarget = new DataSet();
System.Data.DataTable dtTarget = new DataTable();
SqlConnection lodcConn1 = new SqlConnection();
SqlConnection lodcConn2 = new SqlConnection();
lodcConn1.ConnectionString = String.Format("Data Source=.;Initial Catalog= TEMP_KAMal;Integrated Security=True");
lodcConn2.ConnectionString = String.Format("Data Source=pc2;Initial Catalog= AAMIT;Integrated Security=True");
SqlDataAdapter lodaSource = new SqlDataAdapter(@"Select ItemDetailId,ItemUsrCode from tbl_Inventory", lodcConn1);
DataSet ds;
lodcConn1.Open();
lodcConn2.Open();
try
{
string dadel = "delete from tbl_inventory";
SqlCommand cmddel = new SqlCommand (dadel,lodcConn2 );
cmddel.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter("select * from tbl_Inventory", lodcConn1);
DataSet ds1 = new DataSet();
da.Fill(ds1,"temp");
int i=0;
foreach (DataRow dr in ds1.Tables["temp"].Rows)
{
string str = "insert into tbl_Inventory values(" + dr.Table.Rows[i].ItemArray[0] + " , " + dr.Table.Rows[i].ItemArray[1] + ")";
SqlCommand cmd = new SqlCommand(str, lodcConn2);
cmd.ExecuteNonQuery();
i++;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
finally
{
// wrong
lodcConn1.Close();
lodcConn2.Close();
lodcConn1.Dispose();
lodcConn2.Dispose();
lodaSource.Dispose();
//lodaTarget.Dispose();
}
}
}
}
Nothing is really over,untill the moment stop trying for it...
Amitsp(MCTS,MCP)
sqlreporting.blogspot.com
![]() |
0 |
![]() |
prajapatiamit2003:
lodcConn1.ConnectionString = String.Format("Data Source=.;Initial Catalog= TEMP_KAMal;Integrated Security=True");
lodcConn2.ConnectionString = String.Format("Data Source=pc2;Initial Catalog= AAMIT;Integrated Security=True");Why used two connection string?
in Data source try Servername\nstance name.
In you case server name is pc2. I am not sure what is your instance name.
If you instance name is SQL2000 the your connection string would be
lodcConn2.ConnectionString = String.Format("Data Source=pc2\SQL2000;Initial Catalog= AAMIT;Integrated Security=True");
Everything is possible!
![]() |
0 |
![]() |
how can i enable my remote connection in sql-server 2000
Nothing is really over,untill the moment stop trying for it...
Amitsp(MCTS,MCP)
sqlreporting.blogspot.com
![]() |
0 |
![]() |
I hope this will help you
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=802150&SiteID=1
Everything is possible!
![]() |
0 |
![]() |
dear
i was see this link but there is nothing related to sql-server 2000 remote connection
u have other soluction plz tell me
i wait for u r replay
Nothing is really over,untill the moment stop trying for it...
Amitsp(MCTS,MCP)
sqlreporting.blogspot.com
![]() |
0 |
![]() |