Note that there are some explanatory texts on larger screens.

plurals
  1. POA network-related or instance-specific error occurred while establishing a connection to SQL Server
    primarykey
    data
    text
    <p>I m getting this code when i want to interact with database.</p> <p>my web.config contains a connection string that is:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;configuration&gt; &lt;connectionStrings&gt; &lt;add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/&gt; &lt;add name="WebNewYearConnectionString" connectionString="Data Source=XXXX; Initial Catalog=XXXXX; User ID=XXXXX; Password=XXXXXX;" providerName="System.Data.SqlClient"/&gt; &lt;/connectionStrings&gt; &lt;system.web&gt; &lt;compilation debug="true" targetFramework="4.0"/&gt; &lt;customErrors mode="Off"/&gt; &lt;authentication mode="Forms"&gt; &lt;forms loginUrl="~/Account/Login.aspx" timeout="2880"/&gt; &lt;/authentication&gt; &lt;membership&gt; &lt;providers&gt; &lt;clear/&gt; &lt;add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/&gt; &lt;/providers&gt; &lt;/membership&gt; &lt;profile&gt; &lt;providers&gt; &lt;clear/&gt; &lt;add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/&gt; &lt;/providers&gt; &lt;/profile&gt; &lt;roleManager enabled="false"&gt; &lt;providers&gt; &lt;clear/&gt; &lt;add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/&gt; &lt;add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/&gt; &lt;/providers&gt; &lt;/roleManager&gt; &lt;/system.web&gt; &lt;system.webServer&gt; &lt;modules runAllManagedModulesForAllRequests="true"/&gt; &lt;/system.webServer&gt; &lt;system.data&gt; &lt;DbProviderFactories&gt; &lt;remove invariant="System.Data.SqlServerCe.4.0"/&gt; &lt;add name="Microsoft SQL Server Compact Edition Client Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact Edition Client 4.0" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/&gt; &lt;/DbProviderFactories&gt; &lt;/system.data&gt; </code></pre> <p></p> <p>and my code contains </p> <pre><code>xSqlConnections con = new SqlConnections("System.Configuration.ConfigurationManager.ConnectionStrings["WebNewYearConnectionString"].ConnectionString"); protected void Page_Load(object sender, EventArgs e) { string Clientname = Request.QueryString["name"]; string str = "select * from Client_Detail where Client_Name='" + Clientname + "'"; DataTable dat; SqlDataAdapter da = new SqlDataAdapter(sql, con); DataSet ds = new DataSet(); da.Fill(ds, "tab"); DataTable dat = new DataTable(); dat = ds.Tables["tab"]; EventName.Text = dat.Rows[0]["Event_Name"].ToString(); Event_Description.Text = dat.Rows[0]["Description"].ToString(); Event_Date.Text = dat.Rows[0]["Date"].ToString(); Entry_Fee.Text = dat.Rows[0]["Price"].ToString(); Event_Client.Text = dat.Rows[0]["Client_Name"].ToString(); Event_Location.Text = dat.Rows[0]["Event_Location"].ToString(); Session["Event_Name"] = EventName.Text; } </code></pre> <p>and my code is giving this error </p> <p>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)</p> <p>in </p> <p><em><strong>da.Fill(ds, "tab");</em></strong> </p> <p>this line</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload