» An ultimate catalog of computer data
Forum posts for sqlservr.exe
Process sqlservr.exe keeps running after Connection.Close() in C#
I created a connection to a SQL database, but when I close it, the process sqlservr.exe keeps running even after closing the application. I've tried to use Dispose too, but had the same problem. sqlservr.exe is meant to keep running(It wasn't before starting the application)? Is there any way of killing it?
namespace WindowsFormsApplication3
{
public partial id Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string conexao = 'Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\SMITH\Documents\C#\WindowsFormsApplication3\WindowsFormsApplication3\Database1.mdf;Integrated Security=True';
SqlConnection conn = new SqlConnection(conexao);
SqlCommand comando = new SqlCommand('SELECT COUNT(*) FROM Usuarios WHERE NomeUser = @user and SenhaUser = @senha', conn);
comando.Parameters.Add('@user', SqlDbType.VarChar).Value = textBox1.Text;
comando.Parameters.Add('@senha', SqlDbType.VarChar).Value = textBox2.Text;
conn.Open();
int i = (int)comando.ExecuteScalar();
string a = i.ToString();
textBox3.Text = a;
if(i>0){
MessageBox.Show('Existe');
}else{
MessageBox.Show('Nem existe');
conn.Dispose();
}
}
}
}
View complete forum thread with replies
Other posts related to sqlservr.exe
See Related Forum Messages: Follow the Links Below to View Complete Thread
Process sqlservr.exe keeps running after Connection.Close() in C#
Detecting SqlServr.exe WriteFile Operation Within C#
How to find SQL Server running port?
How to allow SQL Server Express to use multiple cores?