I have a problem opening a connection to a local database in SQL Server 2008 R2.
The opening method that is giving error is as follows:
public static SqlConnection AbreConexao()
{
string path = System.IO.Directory.GetCurrentDirectory();
_DataSource = INI.LerINI(@path + "\ConfigDB.ini", "DataSource");
_InitialCatalog = INI.LerINI(@path + "\ConfigDB.ini", "InitialCatalog");
_UserId = INI.LerINI(@path + "\ConfigDB.ini", "UserId");
_Password = INI.LerINI(@path + "\ConfigDB.ini", "Password");
connString = "Data Source=" + _DataSource + ";Initial Catalog=" + _InitialCatalog + ";User Id=" + _UserId + ";Password=" + _Password + "";
conn = new SqlConnection(connString);
try
{
conn.Open();
}
catch (SqlException ex)
{
conn = null;
MessageBox.Show(ex.Message);
Application.Exit();
}
return conn;
}
The ConnectionString looks like this:
'Data Source=ADMIN;Initial Catalog=ControleFinanceiro;User Id=Admin\User;Password='
At the time of opening the connection it displays the following error:
"A connection to the server was established successfully, but a during the logon process. (provider: Shared Memory Provider, error: 0 - There is no process at the other end of the pipe.) "
I have already released the protocols in SQL Configuration Manager for TCP / IP, NamedPipes and Shared Memory.
The Allow Remote Connections check in the DB connection configuration is also enabled.
Does anyone have an idea to solve?