title: Making many SqlConnections in webforms
body: <p>Because I have to constantly make database calls to get data to show in repeaters and modals I have to repeat code in every page multiple times like this and just looks plain dirty</p>
  
  <pre><code>using(SqlConnection con = new SqlConnection(conStr))
  { 
        using(SqlCommand cmd = new SqlCommand(query,con))
        {
            con.Open();
            cmd.ExecuteNonQuery(),
            // End
         }
  }
  </code></pre>
  
  <p>For inserting or updating or get datatables... As the project grows it becomes hard to track every single connection specially when an exception happens and there's so many of these in every page on code behind that the code just becomes dirty and a pain to look at.</p>
  
  <p>My question... Is there a more efficient way to get database calls? I have been reading about entity framework and already tried the whole tutorial on microsoft docs and seems pretty nice and neat looking and easy to find things but also seems hard to implement when there are many tables  'cause have to update code whenever have to change database and do migrations and vice versa so rather than just updating database, have to do both.</p>
  
  <p>Also another question, is it fine If i never close my connection on using statements because they close it? I think i avoid just to not make the program waste resources calling an extra fuction to do the same thing or is there any difference if i close the connection after executing the command?</p>