(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / ByteFX.Data / mysqlclient / docs / MySqlDataAdapter.xml
blob40d07857c4da1cd85c0b91cf5336e6499a05c6e4
1 <MyDocs>\r
2 <MyMembers name="Class">\r
3 <remarks>\r
4         <para>\r
5         The <B>MySQLDataAdapter</B>, serves as a bridge between a <see cref="System.Data.DataSet"/>\r
6         and MySQL for retrieving and saving data. The <B>MySQLDataAdapter</B> provides this \r
7         bridge by mapping <see cref="DbDataAdapter.Fill"/>, which changes the data in the \r
8         <B>DataSet</B> to match the data in the data source, and <see cref="DbDataAdapter.Update"/>, \r
9         which changes the data in the data source to match the data in the <B>DataSet</B>, \r
10         using the appropriate SQL statements against the data source.\r
11         </para>\r
12         <para>\r
13         When the <B>MySQLDataAdapter</B> fills a <B>DataSet</B>, it will create the necessary \r
14         tables and columns for the returned data if they do not already exist. However, primary \r
15         key information will not be included in the implicitly created schema unless the \r
16         <see cref="System.Data.MissingSchemaAction"/> property is set to <see cref="System.Data.MissingSchemaAction.AddWithKey"/>. \r
17         You may also have the <B>MySQLDataAdapter</B> create the schema of the <B>DataSet</B>, \r
18         including primary key information, before filling it with data using <see cref="System.Data.Common.DbDataAdapter.FillSchema"/>. \r
19         </para>\r
20         <para><B>MySQLDataAdapter</B> is used in conjunction with <see cref="MySqlConnection"/>\r
21         and <see cref="MySqlCommand"/> to increase performance when connecting to a MySQL database.\r
22         </para>\r
23         <para>The <B>MySQLDataAdapter</B> also includes the <see cref="MySqlDataAdapter.SelectCommand"/>, \r
24         <see cref="MySqlDataAdapter.InsertCommand"/>, <see cref="MySqlDataAdapter.DeleteCommand"/>, \r
25         <see cref="MySqlDataAdapter.UpdateCommand"/>, and <see cref="DataAdapter.TableMappings"/> \r
26         properties to facilitate the loading and updating of data.\r
27         </para>\r
28         <para>When an instance of <B>MySQLDataAdapter</B> is created, the read/write properties \r
29         are set to initial values. For a list of these values, see the <B>MySQLDataAdapter</B> \r
30         constructor.\r
31         </para>\r
32 </remarks>\r
34 <example>\r
35         The following example creates a <see cref="MySqlCommand"/> and a <see cref="MySqlConnection"/>. \r
36         The <B>MySqlConnection</B> is opened and set as the <see cref="MySqlCommand.Connection"/> for the \r
37         <B>MySqlCommand</B>. The example then calls <see cref="MySqlCommand.ExecuteNonQuery"/>, and closes \r
38         the connection. To accomplish this, the <B>ExecuteNonQuery</B> is \r
39         passed a connection string and a query string that is a SQL INSERT \r
40         statement.\r
41         <code lang="Visual Basic">\r
42 Public Function SelectRows(dataSet As DataSet, connection As String, query As String) As DataSet\r
43     Dim conn As New MySqlConnection(connection)\r
44     Dim adapter As New MySqlDataAdapter()\r
45     adapter.SelectCommand = new MySqlCommand(query, conn)\r
46     adapter.Fill(dataset)\r
47     Return dataset\r
48 End Function\r
49         </code>\r
50         <code lang="C#">\r
51 public DataSet SelectRows(DataSet dataset,string connection,string query) \r
52 {\r
53     MySqlConnection conn = new MySqlConnection(connection);\r
54     MySqlDataAdapter adapter = new MySqlDataAdapter();\r
55     adapter.SelectCommand = new MySqlCommand(query, conn);\r
56     adapter.Fill(dataset);\r
57     return dataset;\r
58 }\r
59         </code>\r
60 </example>\r
61 </MyMembers>\r
63 <MyMembers name="ConnectionTimeout">\r
64         <exception cref="System.ArgumentException">The value set is less than 0.</exception>\r
65         <remarks>\r
66                 A value of 0 indicates no limit, and should be avoided in a <see cref="MySqlConnection.ConnectionString"/> \r
67                 because an attempt to connect will wait indefinitely.\r
68         </remarks>\r
69         <example>\r
70                 The following example creates a MySqlConnection\r
71                 and sets some of its properties in the connection string.\r
72                 <code lang="Visual Basic"><c>\r
73 Public Sub CreateSqlConnection()\r
74         Dim myConnection As New MySqlConnection()\r
75         myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30"\r
76         myConnection.Open()\r
77 End Sub\r
78 </c></code>\r
79 <code lang="C#"><c>\r
80 public void CreateSqlConnection() \r
81 {\r
82         MySqlConnection myConnection = new MySqlConnection();\r
83         myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30";\r
84         myConnection.Open();\r
85 }\r
86 </c></code>                             \r
87         </example>\r
88 </MyMembers>\r
90 </MyDocs>