title: How to email error msg in catch
body: <p>I have the code below which I now need to figure out how to not only display but also email it all to my email, this way should any user encounter a error we get to see exactly what is it.</p>
  
  <pre><code>Catch ex As Exception
        lblInformation.Text = ("&lt;h4&gt;Unable to save data in database&lt;/h4&gt;" + vbNewLine + "The error was '" + ex.Message + "'" + vbNewLine + vbNewLine + "The SQL Command which falied was:" + vbNewLine + "&lt;strong&gt;" + mySQL + "&lt;/strong&gt;" + vbNewLine + "Please contact the Service Desk to report this error.").Replace(vbNewLine, "&lt;br /&gt;" + vbNewLine)
        booInsertedRecord = False
  Finally
        myConnection.Close()
  End Try
  </code></pre>
  
  <p>I Tried inserting</p>
  
  <pre><code>SmtpMail.Send(objEMail)
  </code></pre>
  
  <p>in a new line above "booInsertedRecord = False" and then creating a new "Dim objEMail New MailMessage()" but then realised that won't work because it's msg is defined in the catch so not to sure what steps next to take.</p>
  
  <p>It's been a while since I used VB and I didn't need to use anything like this then so any assistance would be greatly appreciated.</p>
  
  <p>Edit - @tzup ToString() shows </p>
  
  <pre><code>[The error was 'System.Data.SqlClient.SqlException: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
  The statement has been terminated.
  at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
  at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
  at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
  at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
  at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
  at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
  at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
  at ASP.bulletinform_aspx.Upload_Click(Object source, EventArgs e) in E:\Bulletin\Bulletin\Bulletin\BulletinForm.aspx:line 415']
  </code></pre>
  
  <p>would of put this in a comment if I had space, line 415 is <code>myUpdate.ExecuteNonQuery()</code></p>