title: Timeout error connecting to Sql Express
body: <p>I try to update a table, but I get this error:</p>
  
  <blockquote>
    <p>Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated.</p>
  </blockquote>
  
  <p>This is a part of my code:</p>
  
  <pre><code>Image x = Image.FromFile(o.FileName);
  MemoryStream ms = new MemoryStream();
  x.Save(ms, x.RawFormat);
  byte[] a = ms.GetBuffer();
  ms.Close();
  SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\conectare.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
  con.Open();
  SqlCommand cmd = new SqlCommand();
  cmd.Parameters.Clear();
  cmd.Parameters.AddWithValue("@imagine", a);
  cmd.Connection = con;
  SqlDataAdapter da = new SqlDataAdapter("SELECT * from login", con);
  da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
  SqlCommandBuilder obj = new SqlCommandBuilder(da);
  DataSet ds = new DataSet();
  da.Fill(ds, "login");
  DataRow dr= ds.Tables[0].Rows[ind1(username)];
  dr.BeginEdit();
  dr["imagine"] = a;
  dr.EndEdit();
  try
  { da.Update(ds, ds.Tables[0].TableName); 
   pictureBox1.Image = Image.FromFile(o.FileName);
  }
  catch (Exception ex)
  {
      MessageBox.Show(ex.ToString() + Environment.NewLine + "Please try again!", "SORRY", MessageBoxButtons.OK, MessageBoxIcon.Error);
  }
  </code></pre>