The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MySqlException.xml 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <MyDocs>
  2. <MyMembers name="Class">
  3. <remarks>
  4. <para>
  5. This class is created whenever the MySql Data Provider encounters an error generated from the server.
  6. </para>
  7. <para>
  8. Any open connections are not automatically closed when an exception is thrown. If
  9. the client application determines that the exception is fatal, it should close any open
  10. <see cref="MySqlDataReader"/> objects or <see cref="MySqlConnection"/> objects.
  11. </para>
  12. </remarks>
  13. <example>
  14. The following example generates a <B>MySqlException</B> due to a missing server,
  15. and then displays the exception.
  16. <code lang="vbnet">
  17. Public Sub ShowException()
  18. Dim mySelectQuery As String = "SELECT column1 FROM table1"
  19. Dim myConnection As New MySqlConnection ("Data Source=localhost;Database=Sample;")
  20. Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
  21. Try
  22. myCommand.Connection.Open()
  23. Catch e As MySqlException
  24. MessageBox.Show( e.Message )
  25. End Try
  26. End Sub
  27. </code>
  28. <code lang="C#">
  29. public void ShowException()
  30. {
  31. string mySelectQuery = "SELECT column1 FROM table1";
  32. MySqlConnection myConnection =
  33. new MySqlConnection("Data Source=localhost;Database=Sample;");
  34. MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection);
  35. try
  36. {
  37. myCommand.Connection.Open();
  38. }
  39. catch (MySqlException e)
  40. {
  41. MessageBox.Show( e.Message );
  42. }
  43. }
  44. </code>
  45. </example>
  46. </MyMembers>
  47. </MyDocs>