not connecting to DB. RRS feed

  • Question

  • Hi ,

    i have very stange problem.i've written a piece of code to connect to DB, execute stored procedure & fill the dataset with results.I'm using exterpise library to connect to DB.Code looks like this

    Database db = DatabaseFactory.CreateDatabase("DB");
                    DbCommand command = db.GetStoredProcCommand("sp");
                    DataSet ds = null;
                    ds = db.ExecuteDataSet(command);
                    if(ds != null)

    when the control reaches "ExecuteDataSet()" method , its throwing exception.The exception messagelooks like this

    "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"

    I'm able to connect to the same DB through server explorer.When i run the same code from some other machine its working fine , but its not working from my machine.....what could be the reason ?

    Any ideas would be greatly appreciated.





    Monday, April 12, 2010 1:13 PM


All replies