View Single Post
  #1 (permalink)  
Old April 11th, 2009, 12:17 PM
hbansal hbansal is offline
Authorized User
Points: 110, Level: 2
Points: 110, Level: 2 Points: 110, Level: 2 Points: 110, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2007
Location: Delhi, Delhi, India.
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
Default Remote Connection Error: Named Pipes Provider error

Hello Friends

Error Desciption:
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)


Error says problem in remote connection...I have checked dozen of posts of net, giving remedies of remote connection, which is not helping my cause. I have followed each and every step of remote connection, the connection is already enabled. But still the problem persists. Friends please help. I have to submit my major project, all was done until this problem happened. Please solve my problem urgently, please. Some posts say there is a problem in connection string.

Here is the code:
public void connected()
{
con = new SqlConnection("data source=CR32; trusted_connection=yes; database=credit_scoring");
//con.Open();
}
public int login()
{
connection obj = new connection();
obj.connected();
obj.con.Open();
obj.cmd = new SqlCommand("proclogin",obj.con);
obj.cmd.CommandType = CommandType.StoredProcedure;
obj.cmd.Parameters.AddWithValue("acc",acc_no);
obj.cmd.Parameters.AddWithValue("pass",pass);
SqlParameter sp = new SqlParameter();
sp.ParameterName = "@count";
sp.DbType = DbType.Int32;
sp.Direction = ParameterDirection.Output;
obj.cmd.Parameters.Add(sp);
obj.cmd.ExecuteNonQuery();
int flag = Convert.ToInt32(sp.Value);
return flag;
}
Friends I have made a dll file and calling the class of this file to use the above two functions. I think the problem is in datasource, please tell me the appropriate remedy. I have tried of setting datasource as local, but still the problem persists.
Reply With Quote