An alternative to UBB.threads
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.

53 lines
1.6 KiB

<MyDocs>
<MyMembers name="Class">
<remarks>
<para>
This class is created whenever the MySql Data Provider encounters an error generated from the server.
</para>
<para>
Any open connections are not automatically closed when an exception is thrown. If
the client application determines that the exception is fatal, it should close any open
<see cref="MySqlDataReader"/> objects or <see cref="MySqlConnection"/> objects.
</para>
</remarks>
<example>
The following example generates a <B>MySqlException</B> due to a missing server,
and then displays the exception.
<code lang="vbnet">
Public Sub ShowException()
Dim mySelectQuery As String = "SELECT column1 FROM table1"
Dim myConnection As New MySqlConnection ("Data Source=localhost;Database=Sample;")
Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
Try
myCommand.Connection.Open()
Catch e As MySqlException
MessageBox.Show( e.Message )
End Try
End Sub
</code>
<code lang="C#">
public void ShowException()
{
string mySelectQuery = "SELECT column1 FROM table1";
MySqlConnection myConnection =
new MySqlConnection("Data Source=localhost;Database=Sample;");
MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection);
try
{
myCommand.Connection.Open();
}
catch (MySqlException e)
{
MessageBox.Show( e.Message );
}
}
</code>
</example>
</MyMembers>
</MyDocs>