title: Correct error-handling practices for the data-layer
body: <p>What are good things to check for, with respect to error-handling, when you are dealing with the data-access-layer?  For example, let's assume I have this function..</p>
  
  <pre><code>    Public Function UserExists(ByVal userName As String) As DataTable
          Dim dt As Object = Nothing
          Dim arSqlParameters(0) As SqlParameter
          arSqlParameters(0) = New SqlParameter("@UserName", SqlDbType.NVarChar, 50)
          arSqlParameters(0).value = userName
          dt = ABC.APP.DAL.DALHelper.ExecuteDatatable(ConnectionString, CommandType.StoredProcedure, "dbo.aspnet_sprGetUserByUsername", arSqlParameters)
          Return dt
      End Function
  </code></pre>
  
  <p>This seems like very lazy and unsafe coding.  How would you go about ensuring that your code elegantly handles anything unexpected in a situation like this?</p>
  
  <p>I'm new to vb.net and the app that I'm working on has no error handling, so I figured this would be the best place to look for advice.  Thanks in advance :)</p>