Error: Cannot connect to server
<p>When I try to run the program it starts normal but when I input the correct answer and hit enter the error:</p>

<p>ErrorA 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>Is there something wrong with my code below? If there are no errors what could I possibly do to fix it?</p>

<pre><code>        if (txt1.Text == "A" &amp;&amp; txt2.Text == "B" &amp;&amp; txt3.Text == "C" &amp;&amp; txt4.Text == "D" &amp;&amp; txt5.Text == "E" &amp;&amp; txt6.Text == "F" &amp;&amp; txt7.Text == "G" &amp;&amp; txt8.Text == "H")
        {
            var txt = new[] { txt1, txt2, txt3, txt4, txt5, txt6, txt7, txt8};
            for (int i = 0; i &lt; 8; i++)
            {
                txt[i].Enabled = false;
            }
            SqlConnection conn = new SqlConnection("Server=localhost;Database=abcdefgh;uid=root");
            try
            {
                conn.Open();
                SqlCommand insert = new SqlCommand("INSERT INTO txt_abcdefgh (a_txt1, b_txt2, c_txt3, d_txt4, e_txt5, f_txt6, g_txt7, h_txt8) VALUES('" + txt1.Text + "','" + txt2.Text + "','" + txt3.Text + "','" + txt4.Text + "','" + txt5.Text + "','" + txt6.Text + "','" + txt7.Text + "','" + txt8.Text + ";)", conn);
                insert.ExecuteNonQuery();
                MessageBox.Show("");
                pnlEasy.Visible = true;
                Height = 476;
                Width = 336;
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex.Message);
            }
        }
        else
        {
            MessageBox.Show("Wrong answer" + "\nTry Again");
        }
</code></pre>