C# SQL Server connection error System.Data.SqlClient.SqlException (0x80131904)

0

I have tried to connect to my databse in sql server. My code is the following:

 private void button1_Click(object sender, EventArgs e)
        {
          
            SqlConnection cnn;
           string connetionString = "Server = ULTRABOOK - JJ/MSSQLSERVERML;" +
            "Initial Catalog = Research;" +
            "User id = ULTRABOOK-JJ/jurje;" +
            "Password = \"\";";

            cnn = new SqlConnection(connetionString);
            try
            {
                cnn.Open();
                MessageBox.Show("Connection Open ! ");
                cnn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }

I get this error:

System.Data.SqlClient.SqlException (0x80131904): 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 the SQL server is configured to allow remote connections. (provider: Named Pipes Provide, error: 40 - Could not open a connection to SQL Server)

c#
sql
sql-server
database-connection
asked on Stack Overflow Mar 12, 2021 by JJNL77 • edited Mar 12, 2021 by JJNL77

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0