dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] Error connecting to the database

  1. #1
    Join Date
    Mar 2011
    Location
    Nijmegen
    Posts
    10

    resolved [RESOLVED] Error connecting to the database

    Hi All,
    I am bit new to ASP.NET C#, I want to make a connection to my database but I am getting the next error: "provider: Provider from named pipes, error: 40 - Could not connect to SQL Server"

    This is the connection:
    string connStr = "server=DB-NB-003\MSSQL_DB_NB_003;Trusted_Connection=true;database=Bouwgegevens";

    This is my total code:
    public partial class _Default : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    DataSet ds = new DataSet();
    string connStr = "server=DB-NB-003\MSSQL_DB_NB_003;Trusted_Connection=true;database=Bouwgegevens";
    using (SqlConnection conn = new SqlConnection(connStr))
    {
    string sql = "Select Menu_Id, Menu_Titel, Menu_Body, Menu_ParentId from tbMenu";
    SqlDataAdapter da = new SqlDataAdapter(sql, conn);
    da.Fill(ds);
    da.Dispose();
    }
    ds.DataSetName = "Menus";
    ds.Tables[0].TableName = "Menu";
    DataRelation relation = new DataRelation("ParentChild",
    ds.Tables["Menu"].Columns["Menu_Id"],
    ds.Tables["Menu"].Columns["Menu_ParentId"],
    true);

    relation.Nested = true;
    ds.Relations.Add(relation);

    xmlDataSource.Data = ds.GetXml();

    if (Request.Params["Sel"] != null)
    Page.Controls.Add(new System.Web.UI.LiteralControl("You selected " + Request.Params["Sel"]));
    }
    }

    Hope anyone can help me?

    Many thanks,
    Johan Veldkamp

  2. #2
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    Hi,

    Named pipe error is caused by your SQL server not being configured corrected to allow connections using Named Pipes.

    You need to start SQL Server Configuration Manager and follow the instructions here:

    http://blog.sqlauthority.com/2009/05...-server-error/

    regards


    Ribs

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles