File: MySqlHelper.xml

package info (click to toggle)
mysql-connector-net 6.4.3-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,160 kB
  • ctags: 8,552
  • sloc: cs: 63,689; xml: 7,505; sql: 345; makefile: 50; ansic: 40
file content (53 lines) | stat: -rw-r--r-- 1,647 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<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>