I'm trying to make a program for entering / editing and deleting users in a MySQL database. The database is external.
I have tried to change SqlConnection several times
con = new SqlConnection ("Data Source = ip /; Initial Catalog = u181542750_arsob; Integrated Security = True");
Complete CODE PASTEBIN
private void button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=sql34.main-hosting.eu;Initial Catalog=u181542750_arsob;Integrated Security=True");
con.Open();
cmd = new SqlCommand("INSERT INFO Archers (Nume,Prenume,Varsta,Sex,Categorie,E-mail,Telefon,CNP) VALUES (@Nume,@Prenume,@Varsta,@Sex,@Categorie,@E-mail,@Telefon,@CNP)", con);
cmd.Parameters.AddWithValue("@Nume", textBox1.Text);
cmd.Parameters.AddWithValue("@Prenume", textBox2.Text);
cmd.Parameters.AddWithValue("@Varsta", textBox3.Text);
cmd.Parameters.AddWithValue("@Sex", comboBox1.SelectedItem.ToString());
cmd.Parameters.AddWithValue("@Categorie", comboBox2.SelectedItem.ToString());
cmd.Parameters.AddWithValue("@E-mail", textBox4.Text);
cmd.Parameters.AddWithValue("@Telefon", textBox5.Text);
cmd.Parameters.AddWithValue("@CNP", textBox6.Text);
cmd.ExecuteNonQuery();
}
System.Data.SqlClient.SqlException: '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)'
Win32Exception: The network path was not found