|
<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="Visual Basic">
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>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here