1 <?xml version="1.0"?>
\r
4 <name>MySql.Data</name>
\r
7 <member name="T:MySql.Data.Common.DBConnectionString">
\r
9 Summary description for Utility.
12 <member name="T:MySql.Data.Common.NamedPipeStream">
\r
14 Summary description for API.
17 <member name="M:MySql.Data.Common.Platform.#ctor">
\r
19 By creating a private ctor, we keep the compiler from creating a default ctor
\r
22 <member name="T:MySql.Data.Common.SocketStream">
\r
24 Summary description for MySqlSocket.
\r
27 <member name="T:MySql.Data.Common.StreamCreator">
\r
29 Summary description for StreamCreator.
32 <member name="T:MySql.Data.Common.DBVersion">
\r
34 Summary description for Version.
37 <member name="T:MySql.Data.Types.MySqlBinary">
\r
39 Summary description for MySqlBinary
\r
42 <member name="T:MySql.Data.Types.MySqlValue">
\r
47 <member name="F:MySql.Data.Types.MySqlValue.numberFormat">
\r
50 <member name="F:MySql.Data.Types.MySqlValue.objectValue">
\r
53 <member name="F:MySql.Data.Types.MySqlValue.dbType">
\r
54 <summary>The generic dbtype of this value</summary>
\r
56 <member name="F:MySql.Data.Types.MySqlValue.mySqlDbType">
\r
57 <summary>The specific MySQL db type</summary>
\r
59 <member name="F:MySql.Data.Types.MySqlValue.mySqlTypeName">
\r
60 <summary>The MySQL specific typename of this value</summary>
\r
62 <member name="F:MySql.Data.Types.MySqlValue.classType">
\r
63 <summary>The system type represented by this value</summary>
\r
65 <member name="F:MySql.Data.Types.MySqlValue.isNull">
\r
66 <summary>Is this value null</summary>
\r
68 <member name="M:MySql.Data.Types.MySqlValue.#ctor">
\r
73 <member name="M:MySql.Data.Types.MySqlValue.GetMySqlTypeName">
\r
76 <member name="M:MySql.Data.Types.MySqlValue.ToString">
\r
77 <summary>Returns a string representation of this value</summary>
\r
79 <member name="P:MySql.Data.Types.MySqlValue.ValueAsObject">
\r
80 <summary>Returns the value of this field as an object</summary>
\r
82 <member name="P:MySql.Data.Types.MySqlValue.IsNull">
\r
87 <member name="T:MySql.Data.Types.MySqlBit">
\r
89 Summary description for MySqlUInt64.
\r
92 <member name="T:MySql.Data.Types.MySqlByte">
\r
94 Summary description for MySqlByte.
\r
97 <member name="T:MySql.Data.Types.MySqlConversionException">
\r
99 Summary description for MySqlConversionException.
\r
102 <member name="M:MySql.Data.Types.MySqlConversionException.#ctor(System.String)">
\r
103 <summary>Ctor</summary>
\r
105 <member name="T:MySql.Data.Types.MySqlDateTime">
\r
107 Summary description for MySqlDateTime.
\r
110 <member name="M:MySql.Data.Types.MySqlDateTime.GetDateTime">
\r
111 <summary>Returns this value as a DateTime</summary>
\r
113 <member name="M:MySql.Data.Types.MySqlDateTime.ToString">
\r
114 <summary>Returns a MySQL specific string representation of this value</summary>
\r
116 <member name="M:MySql.Data.Types.MySqlDateTime.op_Explicit(MySql.Data.Types.MySqlDateTime)~System.DateTime">
\r
117 <summary></summary>
\r
118 <param name="val"></param>
\r
119 <returns></returns>
\r
121 <member name="P:MySql.Data.Types.MySqlDateTime.IsValidDateTime">
\r
123 Indicates if this object contains a value that can be represented as a DateTime
\r
126 <member name="P:MySql.Data.Types.MySqlDateTime.Year">
\r
127 <summary>Returns the year portion of this datetime</summary>
\r
129 <member name="P:MySql.Data.Types.MySqlDateTime.Month">
\r
130 <summary>Returns the month portion of this datetime</summary>
\r
132 <member name="P:MySql.Data.Types.MySqlDateTime.Day">
\r
133 <summary>Returns the day portion of this datetime</summary>
\r
135 <member name="P:MySql.Data.Types.MySqlDateTime.Hour">
\r
136 <summary>Returns the hour portion of this datetime</summary>
\r
138 <member name="P:MySql.Data.Types.MySqlDateTime.Minute">
\r
139 <summary>Returns the minute portion of this datetime</summary>
\r
141 <member name="P:MySql.Data.Types.MySqlDateTime.Second">
\r
142 <summary>Returns the second portion of this datetime</summary>
\r
144 <member name="T:MySql.Data.Types.MySqlDecimal">
\r
146 Summary description for MySqlDecimal.
\r
149 <member name="T:MySql.Data.Types.MySqlDouble">
\r
151 Summary description for MySqlDouble.
\r
154 <member name="T:MySql.Data.Types.MySqlInt16">
\r
156 Summary description for MySqlInt16.
\r
159 <member name="T:MySql.Data.Types.MySqlInt32">
\r
161 Summary description for MySqlInt32.
\r
164 <member name="T:MySql.Data.Types.MySqlInt64">
\r
166 Summary description for MySqlInt64.
\r
169 <member name="T:MySql.Data.Types.MySqlFloat">
\r
171 Summary description for MySqlFloat.
\r
174 <member name="T:MySql.Data.Types.MySqlString">
\r
176 Summary description for MySqlString.
\r
179 <member name="T:MySql.Data.Types.MySqlTimeSpan">
\r
181 Summary description for MySqlDateTime.
\r
184 <member name="T:MySql.Data.Types.MySqlUByte">
\r
186 Summary description for MySqlByte.
\r
189 <member name="T:MySql.Data.Types.MySqlUInt16">
\r
191 Summary description for MySqlInt16.
\r
194 <member name="T:MySql.Data.Types.MySqlUInt32">
\r
196 Summary description for MySqlInt32.
\r
199 <member name="T:MySql.Data.Types.MySqlUInt64">
\r
201 Summary description for MySqlUInt64.
\r
204 <member name="T:MySql.Data.MySqlClient.CharSetMap">
\r
206 Summary description for CharSetMap.
209 <member name="M:MySql.Data.MySqlClient.CharSetMap.GetEncoding(MySql.Data.Common.DBVersion,System.String)">
\r
211 Returns the text encoding for a given MySQL character set name
213 <param name="version">Version of the connection requesting the encoding</param>
214 <param name="CharSetName">Name of the character set to get the encoding for</param>
215 <returns>Encoding object for the given character set name</returns>
217 <member name="M:MySql.Data.MySqlClient.CharSetMap.InitializeMapping">
\r
222 <member name="T:MySql.Data.MySqlClient.MySqlCommand">
\r
223 <summary>Represents a SQL statement to execute against a MySQL database. This class cannot be inherited.</summary><remarks>
\r
224 <B>MySqlCommand</B> features the following methods for executing commands at a MySQL database:
\r
225 <list type="table">
\r
226 <listheader><term>Item</term><term>Description</term></listheader>
\r
228 <term><a href="MySql.Data.MySqlClient.MySqlCommand.ExecuteReader_overloads.html">ExecuteReader</a></term>
\r
229 <description>Executes commands that return rows.</description>
\r
232 <term><a href="MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery.html">ExecuteNonQuery</a></term>
\r
233 <description>Executes commands such as SQL INSERT, DELETE, and UPDATE statements.</description>
\r
236 <term><a href="MySql.Data.MySqlClient.MySqlCommand.ExecuteScalar.html">ExecuteScalar</a></term>
\r
237 <description>Retrieves a single value (for example, an aggregate value) from a database.</description>
\r
241 You can reset the <B>CommandText</B> property and reuse the <B>MySqlCommand</B>
\r
242 object. However, you must close the <A href="MySql.Data.MySqlClient.MySqlDataReader.html">MySqlDataReader</A>
\r
243 before you can execute a new or previous command.
\r
245 If a <A href="MySql.Data.MySqlClient.MySqlException.html">MySqlException</A> is
\r
246 generated by the method executing a <B>MySqlCommand</B>, the <A href="MySql.Data.MySqlClient.MySqlConnection.html">MySqlConnection</A>
\r
247 remains open. It is the responsibility of the programmer to close the connection.
\r
250 Prior versions of the provider used the '@' symbol to mark parameters in SQL. This is incompatible
\r
251 with MySQL user variables, so the provider now uses the '?' symbol to locate parameters in SQL. To
\r
252 support older code, you can set 'old syntax=yes' on your connection string. If you do this, please
\r
253 be aware that an exception will not be throw if you fail to define a parameter that you intended to
\r
256 </remarks><example>
\r
257 The following example creates a <A href="frlrfsystemdatasqlclientsqlcommandclasstopic.htm">MySqlCommand</A> and
\r
258 a <B>MySqlConnection</B>. The <B>MySqlConnection</B> is opened and set as the <A href="frlrfsystemdatasqlclientsqlcommandclassconnectiontopic.htm">Connection</A>
\r
259 for the <B>MySqlCommand</B>. The example then calls <A href="frlrfsystemdatasqlclientsqlcommandclassexecutenonquerytopic.htm">ExecuteNonQuery</A>,
\r
260 and closes the connection. To accomplish this, the <B>ExecuteNonQuery</B> is
\r
261 passed a connection string and a query string that is a SQL INSERT
\r
263 <code lang="Visual Basic">
\r
264 Public Sub InsertRow(myConnectionString As String)
\r
265 " If the connection string is null, use a default.
\r
266 If myConnectionString = "" Then
\r
267 myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"
\r
269 Dim myConnection As New MySqlConnection(myConnectionString)
\r
270 Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"
\r
271 Dim myCommand As New MySqlCommand(myInsertQuery)
\r
272 myCommand.Connection = myConnection
\r
273 myConnection.Open()
\r
274 myCommand.ExecuteNonQuery()
\r
275 myCommand.Connection.Close()
\r
279 public void InsertRow(string myConnectionString)
\r
281 // If the connection string is null, use a default.
\r
282 if(myConnectionString == "")
\r
284 myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass";
\r
286 MySqlConnection myConnection = new MySqlConnection(myConnectionString);
\r
287 string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)";
\r
288 MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
\r
289 myCommand.Connection = myConnection;
\r
290 myConnection.Open();
\r
291 myCommand.ExecuteNonQuery();
\r
292 myCommand.Connection.Close();
\r
297 <member name="M:MySql.Data.MySqlClient.MySqlCommand.#ctor">
\r
300 Initializes a new instance of the MySqlCommand class.
\r
303 The following example creates a MySqlCommand and sets some of its properties.
\r
305 <note>This example shows how to use one of the overloaded
\r
306 versions of the MySqlCommand constructor. For other examples that might be available,
\r
307 see the individual overload topics.
\r
310 <code lang="Visual Basic">
\r
311 Public Sub CreateMySqlCommand()
\r
312 Dim myConnection As New MySqlConnection _
\r
313 ("Persist Security Info=False;database=test;server=myServer")
\r
314 myConnection.Open()
\r
315 Dim myTrans As MySqlTransaction = myConnection.BeginTransaction()
\r
316 Dim mySelectQuery As String = "SELECT * FROM MyTable"
\r
317 Dim myCommand As New MySqlCommand(mySelectQuery, myConnection, myTrans)
\r
318 myCommand.CommandTimeout = 20
\r
322 public void CreateMySqlCommand()
\r
324 MySqlConnection myConnection = new MySqlConnection("Persist Security Info=False;
\r
325 database=test;server=myServer");
\r
326 myConnection.Open();
\r
327 MySqlTransaction myTrans = myConnection.BeginTransaction();
\r
328 string mySelectQuery = "SELECT * FROM myTable";
\r
329 MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection,myTrans);
\r
330 myCommand.CommandTimeout = 20;
\r
335 void CreateMySqlCommand()
\r
337 MySqlConnection* myConnection = new MySqlConnection(S"Persist Security Info=False;
\r
338 database=test;server=myServer");
\r
339 myConnection->Open();
\r
340 MySqlTransaction* myTrans = myConnection->BeginTransaction();
\r
341 String* mySelectQuery = S"SELECT * FROM myTable";
\r
342 MySqlCommand* myCommand = new MySqlCommand(mySelectQuery, myConnection, myTrans);
\r
343 myCommand->CommandTimeout = 20;
\r
347 </overloads><summary>
\r
348 Initializes a new instance of the MySqlCommand class.
\r
349 </summary><remarks>
\r
350 The base constructor initializes all fields to their default values. The
\r
351 following table shows initial property values for an instance of <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/>.
\r
352 <list type="table">
\r
353 <listheader><term>Properties</term><term>Initial Value</term></listheader>
\r
354 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandText"/></term><term>empty string ("")</term></item>
\r
355 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandTimeout"/></term><term>0</term></item>
\r
356 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandType"/></term><term>CommandType.Text</term></item>
\r
357 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.Connection"/></term><term>Null</term></item>
\r
360 You can change the value for any of these properties through a separate call to
\r
361 the property.</para>
\r
362 </remarks><example>
\r
363 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> and
\r
364 sets some of its properties.
\r
366 <code lang="Visual Basic">
\r
367 Public Sub CreateMySqlCommand()
\r
368 Dim myCommand As New MySqlCommand()
\r
369 myCommand.CommandType = CommandType.Text
\r
373 public void CreateMySqlCommand()
\r
375 MySqlCommand myCommand = new MySqlCommand();
\r
376 myCommand.CommandType = CommandType.Text;
\r
381 <member name="M:MySql.Data.MySqlClient.MySqlCommand.#ctor(System.String)">
\r
383 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> class with the text of the query.
\r
384 </summary><param name="cmdText">The text of the query.</param><remarks>
\r
385 When an instance of <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> is created,
\r
386 the following read/write properties are set to initial values.
\r
388 <list type="table">
\r
389 <listheader><term>Properties</term><term>Initial Value</term></listheader>
\r
390 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandText"/></term><term><i>cmdText</i></term></item>
\r
391 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandTimeout"/></term><term>0</term></item>
\r
392 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandType"/></term><term>CommandType.Text</term></item>
\r
393 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.Connection"/></term><term>Null</term></item>
\r
396 You can change the value for any of these properties through a separate call to
\r
397 the property.</para>
\r
398 </remarks><example>
\r
399 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> and
\r
400 sets some of its properties.
\r
402 <code lang="Visual Basic">
\r
403 Public Sub CreateMySqlCommand()
\r
404 Dim sql as String = "SELECT * FROM mytable"
\r
405 Dim myCommand As New MySqlCommand(sql)
\r
406 myCommand.CommandType = CommandType.Text
\r
410 public void CreateMySqlCommand()
\r
412 string sql = "SELECT * FROM mytable";
\r
413 MySqlCommand myCommand = new MySqlCommand(sql);
\r
414 myCommand.CommandType = CommandType.Text;
\r
419 <member name="M:MySql.Data.MySqlClient.MySqlCommand.#ctor(System.String,MySql.Data.MySqlClient.MySqlConnection)">
\r
421 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> class
\r
422 with the text of the query and a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>.
\r
423 </summary><param name="cmdText">The text of the query.</param><param name="connection">A <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> that represents the
\r
424 connection to an instance of SQL Server.
\r
426 When an instance of <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> is created,
\r
427 the following read/write properties are set to initial values.
\r
429 <list type="table">
\r
430 <listheader><term>Properties</term><term>Initial Value</term></listheader>
\r
431 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandText"/></term><term><i>cmdText</i></term></item>
\r
432 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandTimeout"/></term><term>0</term></item>
\r
433 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandType"/></term><term>CommandType.Text</term></item>
\r
434 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.Connection"/></term><term><i>connection</i></term></item>
\r
437 You can change the value for any of these properties through a separate call to
\r
438 the property.</para>
\r
439 </remarks><example>
\r
440 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> and
\r
441 sets some of its properties.
\r
443 <code lang="Visual Basic">
\r
444 Public Sub CreateMySqlCommand()
\r
445 Dim conn as new MySqlConnection("server=myServer")
\r
446 Dim sql as String = "SELECT * FROM mytable"
\r
447 Dim myCommand As New MySqlCommand(sql, conn)
\r
448 myCommand.CommandType = CommandType.Text
\r
452 public void CreateMySqlCommand()
\r
454 MySqlConnection conn = new MySqlConnection("server=myserver")
\r
455 string sql = "SELECT * FROM mytable";
\r
456 MySqlCommand myCommand = new MySqlCommand(sql, conn);
\r
457 myCommand.CommandType = CommandType.Text;
\r
462 <member name="M:MySql.Data.MySqlClient.MySqlCommand.#ctor(System.String,MySql.Data.MySqlClient.MySqlConnection,MySql.Data.MySqlClient.MySqlTransaction)">
\r
464 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> class
\r
465 with the text of the query, a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>, and the
\r
466 <see cref="T:MySql.Data.MySqlClient.MySqlTransaction"/>.
\r
467 </summary><param name="cmdText">The text of the query.</param><param name="connection">A <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> that represents the
\r
468 connection to an instance of SQL Server.
\r
469 </param><param name="transaction">The <see cref="T:MySql.Data.MySqlClient.MySqlTransaction"/> in which the <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> executes.</param><remarks>
\r
470 When an instance of <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> is created,
\r
471 the following read/write properties are set to initial values.
\r
473 <list type="table">
\r
474 <listheader><term>Properties</term><term>Initial Value</term></listheader>
\r
475 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandText"/></term><term><i>cmdText</i></term></item>
\r
476 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandTimeout"/></term><term>0</term></item>
\r
477 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandType"/></term><term>CommandType.Text</term></item>
\r
478 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlCommand.Connection"/></term><term><i>connection</i></term></item>
\r
481 You can change the value for any of these properties through a separate call to
\r
482 the property.</para>
\r
483 </remarks><example>
\r
484 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> and
\r
485 sets some of its properties.
\r
487 <code lang="Visual Basic">
\r
488 Public Sub CreateMySqlCommand()
\r
489 Dim conn as new MySqlConnection("server=myServer")
\r
491 Dim txn as MySqlTransaction = conn.BeginTransaction()
\r
492 Dim sql as String = "SELECT * FROM mytable"
\r
493 Dim myCommand As New MySqlCommand(sql, conn, txn)
\r
494 myCommand.CommandType = CommandType.Text
\r
498 public void CreateMySqlCommand()
\r
500 MySqlConnection conn = new MySqlConnection("server=myserver")
\r
502 MySqlTransaction txn = conn.BeginTransaction();
\r
503 string sql = "SELECT * FROM mytable";
\r
504 MySqlCommand myCommand = new MySqlCommand(sql, conn, txn);
\r
505 myCommand.CommandType = CommandType.Text;
\r
510 <member name="M:MySql.Data.MySqlClient.MySqlCommand.Cancel">
\r
512 Attempts to cancel the execution of a MySqlCommand. This operation is not supported.
\r
515 Cancelling an executing command is currently not supported on any version of MySQL.
\r
517 <exception cref="T:System.NotSupportedException">This operation is not supported.</exception>
\r
519 <member name="M:MySql.Data.MySqlClient.MySqlCommand.CreateParameter">
\r
521 Creates a new instance of a <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object.
\r
524 This method is a strongly-typed version of <see cref="M:System.Data.IDbCommand.CreateParameter"/>.
\r
526 <returns>A <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object.</returns>
\r
529 <member name="M:MySql.Data.MySqlClient.MySqlCommand.Consume">
\r
531 Executes all remaining command buffers
534 <member name="M:MySql.Data.MySqlClient.MySqlCommand.GetNextResultSet(MySql.Data.MySqlClient.MySqlDataReader)">
\r
536 Executes command buffers until we hit the next resultset
538 <returns>CommandResult containing the next resultset when hit
539 or null if no more resultsets were found</returns>
541 <member name="M:MySql.Data.MySqlClient.MySqlCommand.CheckState">
\r
543 Check the connection to make sure
545 - it is not currently being used by a reader
546 - and we have the right version of MySQL for the requested command type
549 <member name="M:MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery">
\r
551 Executes a SQL statement against the connection and returns the number of rows affected.
\r
552 </summary><returns>Number of rows affected</returns><remarks>
\r
553 You can use ExecuteNonQuery to perform any type of database operation,
\r
554 however any resultsets returned will not be available. Any output parameters
\r
555 used in calling a stored procedure will be populated with data and can be
\r
556 retrieved after execution is complete.
\r
557 For UPDATE, INSERT, and DELETE statements, the return value is the number
\r
558 of rows affected by the command. For all other types of statements, the return
\r
560 </remarks><example>
\r
561 The following example creates a MySqlCommand and then
\r
562 executes it using ExecuteNonQuery. The example is passed a string that is a
\r
563 SQL statement (such as UPDATE, INSERT, or DELETE) and a string to use to
\r
564 connect to the data source.
\r
565 <code lang="Visual Basic">
\r
566 Public Sub CreateMySqlCommand(myExecuteQuery As String, myConnection As MySqlConnection)
\r
567 Dim myCommand As New MySqlCommand(myExecuteQuery, myConnection)
\r
568 myCommand.Connection.Open()
\r
569 myCommand.ExecuteNonQuery()
\r
570 myConnection.Close()
\r
574 public void CreateMySqlCommand(string myExecuteQuery, MySqlConnection myConnection)
\r
576 MySqlCommand myCommand = new MySqlCommand(myExecuteQuery, myConnection);
\r
577 myCommand.Connection.Open();
\r
578 myCommand.ExecuteNonQuery();
\r
579 myConnection.Close();
\r
584 <member name="M:MySql.Data.MySqlClient.MySqlCommand.ExecuteReader">
\r
585 <summary>Sends the <see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandText"/> to the <see cref="T:MySql.Data.MySqlClient.MySqlConnection">Connection</see>
\r
586 and builds a <see cref="T:MySql.Data.MySqlClient.MySqlDataReader"/>.</summary><returns>A <see cref="T:MySql.Data.MySqlClient.MySqlDataReader"/> object.</returns><remarks>
\r
588 When the <see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandType"/> property is set to <B>StoredProcedure</B>,
\r
589 the <see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandText"/> property should be set to the name of the stored
\r
590 procedure. The command executes this stored procedure when you call
\r
591 <B>ExecuteReader</B>.
\r
594 While the <see cref="T:MySql.Data.MySqlClient.MySqlDataReader"/> is in use, the associated
\r
595 <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> is busy serving the <B>MySqlDataReader</B>.
\r
596 While in this state, no other operations can be performed on the
\r
597 <B>MySqlConnection</B> other than closing it. This is the case until the
\r
598 <see cref="M:MySql.Data.MySqlClient.MySqlDataReader.Close"/> method of the <B>MySqlDataReader</B> is called.
\r
600 </remarks><example>
\r
601 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/>, then executes it by
\r
602 passing a string that is a SQL SELECT statement, and a string to use to connect to the
\r
604 <code lang="Visual Basic">
\r
605 Public Sub CreateMySqlDataReader(mySelectQuery As String, myConnection As MySqlConnection)
\r
606 Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
\r
607 myConnection.Open()
\r
608 Dim myReader As MySqlDataReader
\r
609 myReader = myCommand.ExecuteReader()
\r
611 While myReader.Read()
\r
612 Console.WriteLine(myReader.GetString(0))
\r
621 public void CreateMySqlDataReader(string mySelectQuery, MySqlConnection myConnection)
\r
623 MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection);
\r
624 myConnection.Open();
\r
625 MMySqlDataReader myReader;
\r
626 myReader = myCommand.ExecuteReader();
\r
629 while(myReader.Read())
\r
631 Console.WriteLine(myReader.GetString(0));
\r
637 myConnection.Close();
\r
643 <member name="M:MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(System.Data.CommandBehavior)">
\r
645 Sends the <see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandText"/> to the <see cref="T:MySql.Data.MySqlClient.MySqlConnection">Connection</see>,
\r
646 and builds a <see cref="T:MySql.Data.MySqlClient.MySqlDataReader"/> using one of the <see cref="T:System.Data.CommandBehavior"/> values.
\r
647 </summary><param name="behavior">One of the <see cref="T:System.Data.CommandBehavior"/> values.</param><remarks>
\r
649 When the <see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandType"/> property is set to <B>StoredProcedure</B>,
\r
650 the <see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandText"/> property should be set to the name of the stored
\r
651 procedure. The command executes this stored procedure when you call
\r
652 <B>ExecuteReader</B>.
\r
655 The <see cref="T:MySql.Data.MySqlClient.MySqlDataReader"/> supports a special mode that enables large binary
\r
656 values to be read efficiently. For more information, see the <B>SequentialAccess</B>
\r
657 setting for <see cref="T:System.Data.CommandBehavior"/>.
\r
660 While the <see cref="T:MySql.Data.MySqlClient.MySqlDataReader"/> is in use, the associated
\r
661 <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> is busy serving the <B>MySqlDataReader</B>.
\r
662 While in this state, no other operations can be performed on the
\r
663 <B>MySqlConnection</B> other than closing it. This is the case until the
\r
664 <see cref="M:MySql.Data.MySqlClient.MySqlDataReader.Close"/> method of the <B>MySqlDataReader</B> is called.
\r
665 If the <B>MySqlDataReader</B> is created with <B>CommandBehavior</B> set to
\r
666 <B>CloseConnection</B>, closing the <B>MySqlDataReader</B> closes the connection
\r
670 When calling ExecuteReader with the SingleRow behavior, you should be aware that using a <i>limit</i>
\r
671 clause in your SQL will cause all rows (up to the limit given) to be retrieved by the client. The
\r
672 <see cref="M:MySql.Data.MySqlClient.MySqlDataReader.Read"/> method will still return false after the first row but pulling all rows of data
\r
673 into the client will have a performance impact. If the <i>limit</i> clause is not necessary, it should
\r
676 </remarks><returns>A <see cref="T:MySql.Data.MySqlClient.MySqlDataReader"/> object.</returns>
\r
678 <member name="M:MySql.Data.MySqlClient.MySqlCommand.ExecuteScalar">
\r
680 Executes the query, and returns the first column of the first row in the
\r
681 result set returned by the query. Extra columns or rows are ignored.
\r
682 </summary><returns>
\r
683 The first column of the first row in the result set, or a null reference if the
\r
684 result set is empty
\r
685 </returns><remarks>
\r
686 <para>Use the <B>ExecuteScalar</B> method to retrieve a single value (for example,
\r
687 an aggregate value) from a database. This requires less code than using the
\r
688 <see cref="M:MySql.Data.MySqlClient.MySqlCommand.ExecuteReader"/> method, and then performing the operations necessary
\r
689 to generate the single value using the data returned by a <see cref="T:MySql.Data.MySqlClient.MySqlDataReader"/>
\r
691 <para>A typical <B>ExecuteScalar</B> query can be formatted as in the following C#
\r
694 cmd.CommandText = "select count(*) from region";
\r
695 Int32 count = (int32) cmd.ExecuteScalar();
\r
697 </remarks><example>
\r
698 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> and then
\r
699 executes it using <B>ExecuteScalar</B>. The example is passed a string that is a
\r
700 SQL statement that returns an aggregate result, and a string to use to
\r
701 connect to the data source.
\r
703 <code lang="Visual Basic">
\r
704 Public Sub CreateMySqlCommand(myScalarQuery As String, myConnection As MySqlConnection)
\r
705 Dim myCommand As New MySqlCommand(myScalarQuery, myConnection)
\r
706 myCommand.Connection.Open()
\r
707 myCommand.ExecuteScalar()
\r
708 myConnection.Close()
\r
712 public void CreateMySqlCommand(string myScalarQuery, MySqlConnection myConnection)
\r
714 MySqlCommand myCommand = new MySqlCommand(myScalarQuery, myConnection);
\r
715 myCommand.Connection.Open();
\r
716 myCommand.ExecuteScalar();
\r
717 myConnection.Close();
\r
722 void CreateMySqlCommand(String* myScalarQuery, MySqlConnection* myConnection)
\r
724 MySqlCommand* myCommand = new MySqlCommand(myScalarQuery, myConnection);
\r
725 myCommand->Connection->Open();
\r
726 myCommand->ExecuteScalar();
\r
727 myConnection->Close();
\r
733 <member name="M:MySql.Data.MySqlClient.MySqlCommand.Prepare">
\r
735 Creates a prepared version of the command on an instance of MySQL Server.
\r
736 </summary><remarks>
\r
738 Prepared statements are only supported on MySQL version 4.1 and higher. Calling
\r
739 prepare while connected to earlier versions of MySQL will succeed but will execute
\r
740 the statement in the same way as unprepared.
\r
742 </remarks><example>
\r
743 The following example demonstrates the use of the <b>Prepare</b> method.
\r
744 <code lang="Visual Basic">
\r
745 public sub PrepareExample()
\r
746 Dim cmd as New MySqlCommand("INSERT INTO mytable VALUES (?val)", myConnection)
\r
747 cmd.Parameters.Add( "?val", 10 )
\r
749 cmd.ExecuteNonQuery()
\r
751 cmd.Parameters(0).Value = 20
\r
752 cmd.ExecuteNonQuery()
\r
756 private void PrepareExample()
\r
758 MySqlCommand cmd = new MySqlCommand("INSERT INTO mytable VALUES (?val)", myConnection);
\r
759 cmd.Parameters.Add( "?val", 10 );
\r
761 cmd.ExecuteNonQuery();
\r
763 cmd.Parameters[0].Value = 20;
\r
764 cmd.ExecuteNonQuery();
\r
769 <member name="M:MySql.Data.MySqlClient.MySqlCommand.SerializeParameter(MySql.Data.MySqlClient.PacketWriter,System.String)">
\r
771 Serializes the given parameter to the given memory stream
773 <param name="writer">PacketWriter to stream parameter data to</param>
774 <param name="parmName">Name of the parameter to serialize</param>
776 <para>This method is called by PrepareSqlBuffers to convert the given
777 parameter to bytes and write those bytes to the given memory stream.
780 <returns>True if the parameter was successfully serialized, false otherwise.</returns>
782 <member name="M:MySql.Data.MySqlClient.MySqlCommand.PrepareSqlBuffers(System.String)">
\r
784 Prepares the necessary byte buffers from the given CommandText
786 <returns>Array of byte buffers, one for each SQL command</returns>
788 Converts the CommandText into an array of tokens
789 using TokenizeSql and then into one or more byte buffers that can be
790 sent to the server. If the server supports batching (and we have enabled it),
791 then all commands result in a single byte array, otherwise a single buffer
792 is created for each SQL command (as separated by ';').
793 The SQL text is converted to bytes using the active encoding for the server.
796 <member name="M:MySql.Data.MySqlClient.MySqlCommand.PrepareCommandText(System.String)">
\r
798 Prepares CommandText for use with the Prepare method
800 <returns>Command text stripped of all paramter names</returns>
802 Takes the output of TokenizeSql and creates a single string of SQL
803 that only contains '?' markers for each parameter. It also creates
804 the parameterMap array list that includes all the paramter names in the
805 order they appeared in the SQL
808 <member name="M:MySql.Data.MySqlClient.MySqlCommand.TokenizeSql(System.String)">
\r
810 Breaks the given SQL up into 'tokens' that are easier to output
811 into another form (bytes, preparedText, etc).
813 <param name="sql">SQL to be tokenized</param>
814 <returns>Array of tokens</returns>
815 <remarks>The SQL is tokenized at parameter markers ('?') and at
816 (';') sql end markers if the server doesn't support batching.
819 <member name="M:MySql.Data.MySqlClient.MySqlCommand.System#ICloneable#Clone">
\r
821 Creates a clone of this MySqlCommand object. CommandText, Connection, and Transaction properties
822 are included as well as the entire parameter list.
824 <returns>The cloned MySqlCommand object</returns>
826 <member name="P:MySql.Data.MySqlClient.MySqlCommand.CommandText">
\r
828 Gets or sets the SQL statement to execute at the data source.
\r
830 The SQL statement or stored procedure to execute. The default is an empty string.
\r
833 When the <see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandType"/> property is set to <B>StoredProcedure</B>,
\r
834 the <B>CommandText</B> property should be set to the name of the stored procedure.
\r
835 The user may be required to use escape character syntax if the stored procedure name
\r
836 contains any special characters. The command executes this stored procedure when
\r
837 you call one of the Execute methods.
\r
839 </remarks><example>
\r
840 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> and sets some of its properties.
\r
841 <code lang="Visual Basic">
\r
842 Public Sub CreateMySqlCommand()
\r
843 Dim myCommand As New MySqlCommand()
\r
844 myCommand.CommandText = "SELECT * FROM Mytable ORDER BY id"
\r
845 myCommand.CommandType = CommandType.Text
\r
849 public void CreateMySqlCommand()
\r
851 MySqlCommand myCommand = new MySqlCommand();
\r
852 myCommand.CommandText = "SELECT * FROM mytable ORDER BY id";
\r
853 myCommand.CommandType = CommandType.Text;
\r
858 <member name="P:MySql.Data.MySqlClient.MySqlCommand.CommandTimeout">
\r
860 Gets or sets the wait time before terminating the attempt to execute a command
\r
861 and generating an error.
\r
863 The time (in seconds) to wait for the command to execute. The default is 0
\r
866 MySQL currently does not support any method of canceling a pending or exeucting operation. All
\r
867 commands issues against a MySQL server will execute until completion or exception occurs.
\r
870 <member name="P:MySql.Data.MySqlClient.MySqlCommand.CommandType">
\r
871 <summary>Gets or sets a value indicating how the <see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandText"/> property is to be interpreted.
\r
873 One of the <see cref="T:System.Data.CommandType"/> values. The default is <B>Text</B>.
\r
876 When you set the <B>CommandType</B> property to <B>StoredProcedure</B>, you
\r
877 should set the <see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandText"/> property to the name of the stored
\r
878 procedure. The command executes this stored procedure when you call one of the
\r
881 </remarks><example>
\r
882 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> and sets some of its properties.
\r
883 <code lang="Visual Basic">
\r
884 Public Sub CreateMySqlCommand()
\r
885 Dim myCommand As New MySqlCommand()
\r
886 myCommand.CommandType = CommandType.Text
\r
890 public void CreateMySqlCommand()
\r
892 MySqlCommand myCommand = new MySqlCommand();
\r
893 myCommand.CommandType = CommandType.Text;
\r
898 <member name="P:MySql.Data.MySqlClient.MySqlCommand.IsPrepared">
\r
899 <!-- No matching elements were found for the following include tag --><include file="docs/mysqlcommand.xml" path="docs/IsPrepared/*"/>
\r
901 <member name="P:MySql.Data.MySqlClient.MySqlCommand.Connection">
\r
903 Gets or sets the <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> used by this instance of the
\r
904 <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/>.
\r
906 The connection to a data source. The default value is a null reference
\r
907 (<B>Nothing</B> in Visual Basic).
\r
910 If you set <B>Connection</B> while a transaction is in progress and the
\r
911 <see cref="P:MySql.Data.MySqlClient.MySqlCommand.Transaction"/> property is not null, an <see cref="T:System.InvalidOperationException"/>
\r
912 is generated. If the <B>Transaction</B> property is not null and the transaction
\r
913 has already been committed or rolled back, <B>Transaction</B> is set to
\r
916 </remarks><example>
\r
917 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> and sets some of its properties.
\r
918 <code lang="Visual Basic">
\r
919 Public Sub CreateMySqlCommand()
\r
920 Dim mySelectQuery As String = "SELECT * FROM mytable ORDER BY id"
\r
921 Dim myConnectString As String = "Persist Security Info=False;database=test;server=myServer"
\r
922 Dim myCommand As New MySqlCommand(mySelectQuery)
\r
923 myCommand.Connection = New MySqlConnection(myConnectString)
\r
924 myCommand.CommandType = CommandType.Text
\r
928 public void CreateMySqlCommand()
\r
930 string mySelectQuery = "SELECT * FROM mytable ORDER BY id";
\r
931 string myConnectString = "Persist Security Info=False;database=test;server=myServer";
\r
932 MySqlCommand myCommand = new MySqlCommand(mySelectQuery);
\r
933 myCommand.Connection = new MySqlConnection(myConnectString);
\r
934 myCommand.CommandType = CommandType.Text;
\r
939 <member name="P:MySql.Data.MySqlClient.MySqlCommand.Parameters">
\r
940 <summary>Get the <see cref="T:MySql.Data.MySqlClient.MySqlParameterCollection"/></summary><value>The parameters of the SQL statement or stored procedure. The default is
\r
941 an empty collection.</value><remarks>
\r
942 Connector/Net does not support unnamed parameters. Every parameter added to the collection must
\r
943 have an associated name.
\r
944 </remarks><example>
\r
945 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> and displays its parameters.
\r
946 To accomplish this, the method is passed a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>, a query string
\r
947 that is a SQL SELECT statement, and an array of <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> objects.
\r
948 <code lang="Visual Basic">
\r
949 Public Sub CreateMySqlCommand(myConnection As MySqlConnection, _
\r
950 mySelectQuery As String, myParamArray() As MySqlParameter)
\r
951 Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
\r
952 myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=?age"
\r
953 myCommand.UpdatedRowSource = UpdateRowSource.Both
\r
954 myCommand.Parameters.Add(myParamArray)
\r
956 For j = 0 To myCommand.Parameters.Count - 1
\r
957 myCommand.Parameters.Add(myParamArray(j))
\r
959 Dim myMessage As String = ""
\r
961 For i = 0 To myCommand.Parameters.Count - 1
\r
962 myMessage += myCommand.Parameters(i).ToString() & ControlChars.Cr
\r
964 Console.WriteLine(myMessage)
\r
968 public void CreateMySqlCommand(MySqlConnection myConnection, string mySelectQuery,
\r
969 MySqlParameter[] myParamArray)
\r
971 MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection);
\r
972 myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=?age";
\r
973 myCommand.Parameters.Add(myParamArray);
\r
974 for (int j=0; j<myParamArray.Length; j++)
\r
976 myCommand.Parameters.Add(myParamArray[j]) ;
\r
978 string myMessage = "";
\r
979 for (int i = 0; i < myCommand.Parameters.Count; i++)
\r
981 myMessage += myCommand.Parameters[i].ToString() + "\n";
\r
983 MessageBox.Show(myMessage);
\r
988 <member name="P:MySql.Data.MySqlClient.MySqlCommand.Transaction">
\r
990 Gets or sets the <see cref="T:MySql.Data.MySqlClient.MySqlTransaction"/> within which the <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> executes.
\r
992 The <see cref="T:MySql.Data.MySqlClient.MySqlTransaction"/>. The default value is a null reference (<B>Nothing</B> in Visual Basic).
\r
994 You cannot set the <B>Transaction</B> property if it is already set to a
\r
995 specific value, and the command is in the process of executing. If you set the
\r
996 transaction property to a <see cref="T:MySql.Data.MySqlClient.MySqlTransaction"/> object that is not connected
\r
997 to the same <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> as the <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> object,
\r
998 an exception will be thrown the next time you attempt to execute a statement.
\r
1001 <member name="P:MySql.Data.MySqlClient.MySqlCommand.UpdatedRowSource">
\r
1003 Gets or sets how command results are applied to the <see cref="T:System.Data.DataRow"/>
\r
1004 when used by the <see cref="M:System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/> method
\r
1005 of the <see cref="T:System.Data.Common.DbDataAdapter"/>.
\r
1006 </summary><value>One of the <see cref="T:System.Data.UpdateRowSource"/> values.</value><remarks>
\r
1008 The default <see cref="T:System.Data.UpdateRowSource"/> value is
\r
1009 <B>Both</B> unless the command is automatically generated (as in the case of the
\r
1010 <see cref="T:MySql.Data.MySqlClient.MySqlCommandBuilder"/>), in which case the default is <B>None</B>.
\r
1014 <member name="T:MySql.Data.MySqlClient.MySqlCommandBuilder">
\r
1016 Automatically generates single-table commands used to reconcile changes made to a DataSet with the associated MySQL database. This class cannot be inherited.
\r
1017 </summary><remarks>
\r
1018 <para>The <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> does not automatically generate the SQL statements required to
\r
1019 reconcile changes made to a <see cref="T:System.Data.DataSet">DataSet</see> with the associated instance of MySQL.
\r
1020 However, you can create a <B>MySqlCommandBuilder</B> object to automatically generate SQL statements for
\r
1021 single-table updates if you set the <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand">SelectCommand</see> property
\r
1022 of the <B>MySqlDataAdapter</B>. Then, any additional SQL statements that you do not set are generated by the
\r
1023 <B>MySqlCommandBuilder</B>.</para>
\r
1025 <para>The <B>MySqlCommandBuilder</B> registers itself as a listener for <see cref="M:MySql.Data.MySqlClient.MySqlDataAdapter.OnRowUpdating(System.Data.Common.RowUpdatingEventArgs)">RowUpdating</see>
\r
1026 events whenever you set the <see cref="P:MySql.Data.MySqlClient.MySqlCommandBuilder.DataAdapter"/> property. You can only associate one
\r
1027 <B>MySqlDataAdapter</B> or <B>MySqlCommandBuilder</B> object with each other at one time.</para>
\r
1029 <para>To generate INSERT, UPDATE, or DELETE statements, the <B>MySqlCommandBuilder</B> uses the
\r
1030 <B>SelectCommand</B> property to retrieve a required set of metadata automatically. If you change
\r
1031 the <B>SelectCommand</B> after the metadata has is retrieved (for example, after the first update), you
\r
1032 should call the <see cref="M:MySql.Data.MySqlClient.MySqlCommandBuilder.RefreshSchema"/> method to update the metadata.</para>
\r
1034 <para>The <B>SelectCommand</B> must also return at least one primary key or unique
\r
1035 column. If none are present, an <I>InvalidOperation</I> exception is generated,
\r
1036 and the commands are not generated.</para>
\r
1038 <para>The <B>MySqlCommandBuilder</B> also uses the <see cref="P:MySql.Data.MySqlClient.MySqlCommand.Connection">Connection</see>,
\r
1039 <see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandTimeout">CommandTimeout</see>, and <see cref="P:MySql.Data.MySqlClient.MySqlCommand.Transaction">Transaction</see>
\r
1040 properties referenced by the <B>SelectCommand</B>. The user should call
\r
1041 <B>RefreshSchema</B> if any of these properties are modified, or if the
\r
1042 <B>SelectCommand</B> itself is replaced. Otherwise the <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.InsertCommand">InsertCommand</see>,
\r
1043 <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.UpdateCommand">UpdateCommand</see>, and
\r
1044 <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.DeleteCommand">DeleteCommand</see> properties retain
\r
1045 their previous values.</para>
\r
1047 <para>If you call <i>Dispose</i>, the <B>MySqlCommandBuilder</B> is disassociated
\r
1048 from the <B>MySqlDataAdapter</B>, and the generated commands are no longer used.
\r
1052 Caution must be used when using MySqlCOmmandBuilder on MySql 4.0 systems. With MySql 4.0,
\r
1053 database/schema information is not provided to the connector for a query. This means that
\r
1054 a query that pulls columns from two identically named tables in two or more different databases
\r
1055 will not cause an exception to be thrown but will not work correctly. Even more dangerous
\r
1056 is the situation where your select statement references database X but is executed in
\r
1057 database Y and both databases have tables with similar layouts. This situation can cause
\r
1058 unwanted changes or deletes.
\r
1059 This note does not apply to MySQL versions 4.1 and later.
\r
1062 </remarks><example>
\r
1063 The following example uses the <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/>, along
\r
1064 <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> and <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>, to
\r
1065 select rows from a data source. The example is passed an initialized
\r
1066 <see cref="T:System.Data.DataSet"/>, a connection string, a
\r
1067 query string that is a SQL SELECT statement, and a string that is the
\r
1068 name of the database table. The example then creates a <B>MySqlCommandBuilder</B>.
\r
1070 <code lang="Visual Basic">
\r
1071 Public Shared Function SelectRows(myConnection As String, mySelectQuery As String, myTableName As String) As DataSet
\r
1072 Dim myConn As New MySqlConnection(myConnection)
\r
1073 Dim myDataAdapter As New MySqlDataAdapter()
\r
1074 myDataAdapter.SelectCommand = New MySqlCommand(mySelectQuery, myConn)
\r
1075 Dim cb As SqlCommandBuilder = New MySqlCommandBuilder(myDataAdapter)
\r
1079 Dim ds As DataSet = New DataSet
\r
1080 myDataAdapter.Fill(ds, myTableName)
\r
1082 ' Code to modify data in DataSet here
\r
1084 ' Without the MySqlCommandBuilder this line would fail.
\r
1085 myDataAdapter.Update(ds, myTableName)
\r
1088 End Function 'SelectRows
\r
1091 public static DataSet SelectRows(string myConnection, string mySelectQuery, string myTableName)
\r
1093 MySqlConnection myConn = new MySqlConnection(myConnection);
\r
1094 MySqlDataAdapter myDataAdapter = new MySqlDataAdapter();
\r
1095 myDataAdapter.SelectCommand = new MySqlCommand(mySelectQuery, myConn);
\r
1096 MySqlCommandBuilder cb = new MySqlCommandBuilder(myDataAdapter);
\r
1100 DataSet ds = new DataSet();
\r
1101 myDataAdapter.Fill(ds, myTableName);
\r
1103 //code to modify data in DataSet here
\r
1105 //Without the MySqlCommandBuilder this line would fail
\r
1106 myDataAdapter.Update(ds, myTableName);
\r
1116 <member name="M:MySql.Data.MySqlClient.MySqlCommandBuilder.#ctor">
\r
1118 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlCommandBuilder"/> class.
\r
1121 <member name="M:MySql.Data.MySqlClient.MySqlCommandBuilder.#ctor(System.Boolean)">
\r
1123 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlCommandBuilder"/> class
\r
1124 and sets the last one wins property.
\r
1125 </summary><param name="lastOneWins">False to generate change protection code. True otherwise.</param><remarks>
\r
1127 The <i>lastOneWins</i> parameter indicates whether SQL code should be included
\r
1128 with the generated DELETE and UPDATE commands that checks the underlying data
\r
1129 for changes. If <i>lastOneWins</i> is true then this code is not included and
\r
1130 data records could be overwritten in a multi-user or multi-threaded environments.
\r
1131 Setting <i>lastOneWins</i> to false will include this check which will cause a
\r
1132 concurrency exception to be thrown if the underlying data record has changed without
\r
1137 <member name="M:MySql.Data.MySqlClient.MySqlCommandBuilder.#ctor(MySql.Data.MySqlClient.MySqlDataAdapter)">
\r
1139 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlCommandBuilder"/> class
\r
1140 with the associated <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> object.
\r
1141 </summary><param name="adapter">The <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> to use.</param><remarks>
\r
1143 The <see cref="T:MySql.Data.MySqlClient.MySqlCommandBuilder"/> registers itself as a listener for
\r
1144 <see cref="E:MySql.Data.MySqlClient.MySqlDataAdapter.RowUpdating"/> events that are generated by the
\r
1145 <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> specified in this property.
\r
1148 When you create a new instance <B>MySqlCommandBuilder</B>, any existing
\r
1149 <B>MySqlCommandBuilder</B> associated with this <B>MySqlDataAdapter</B>
\r
1154 <member name="M:MySql.Data.MySqlClient.MySqlCommandBuilder.#ctor(MySql.Data.MySqlClient.MySqlDataAdapter,System.Boolean)">
\r
1156 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlCommandBuilder"/> class
\r
1157 with the associated <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> object.
\r
1158 </summary><param name="adapter">The <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> to use.</param><param name="lastOneWins">False to generate change protection code. True otherwise.</param><remarks>
\r
1160 The <see cref="T:MySql.Data.MySqlClient.MySqlCommandBuilder"/> registers itself as a listener for
\r
1161 <see cref="E:MySql.Data.MySqlClient.MySqlDataAdapter.RowUpdating"/> events that are generated by the
\r
1162 <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> specified in this property.
\r
1165 When you create a new instance <B>MySqlCommandBuilder</B>, any existing
\r
1166 <B>MySqlCommandBuilder</B> associated with this <B>MySqlDataAdapter</B>
\r
1170 The <i>lastOneWins</i> parameter indicates whether SQL code should be included
\r
1171 with the generated DELETE and UPDATE commands that checks the underlying data
\r
1172 for changes. If <i>lastOneWins</i> is true then this code is not included and
\r
1173 data records could be overwritten in a multi-user or multi-threaded environments.
\r
1174 Setting <i>lastOneWins</i> to false will include this check which will cause a
\r
1175 concurrency exception to be thrown if the underlying data record has changed without
\r
1180 <member name="M:MySql.Data.MySqlClient.MySqlCommandBuilder.DeriveParameters(MySql.Data.MySqlClient.MySqlCommand)">
\r
1182 Retrieves parameter information from the stored procedure specified
\r
1183 in the MySqlCommand and populates the Parameters collection of the
\r
1184 specified MySqlCommand object.
\r
1185 This method is not currently supported since stored procedures are
\r
1186 not available in MySql.
\r
1188 <param name="command">The MySqlCommand referencing the stored
\r
1189 procedure from which the parameter information is to be derived.
\r
1190 The derived parameters are added to the Parameters collection of the
\r
1191 MySqlCommand.</param>
\r
1192 <exception cref="T:System.InvalidOperationException">The command text is not
\r
1193 a valid stored procedure name.</exception>
\r
1195 <member name="M:MySql.Data.MySqlClient.MySqlCommandBuilder.GetDeleteCommand">
\r
1197 Gets the automatically generated <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> object
\r
1198 required to perform deletions on the database.
\r
1199 </summary><returns>
\r
1200 The <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> object generated to handle delete operations.
\r
1201 </returns><remarks>
\r
1203 An application can use the <B>GetDeleteCommand</B> method for informational
\r
1204 or troubleshooting purposes because it returns the <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/>
\r
1205 object to be executed.
\r
1208 You can also use <B>GetDeleteCommand</B> as the basis of a modified command.
\r
1209 For example, you might call <B>GetDeleteCommand</B> and modify the
\r
1210 <see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandTimeout"/> value, and then explicitly set that on the
\r
1211 <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/>.
\r
1214 After the SQL statement is first generated, the application must explicitly
\r
1215 call <see cref="M:MySql.Data.MySqlClient.MySqlCommandBuilder.RefreshSchema"/> if it changes the statement in any way.
\r
1216 Otherwise, the <B>GetDeleteCommand</B> will be still be using information
\r
1217 from the previous statement, which might not be correct. The SQL statements
\r
1218 are first generated either when the application calls
\r
1219 <see cref="M:System.Data.Common.DataAdapter.Update(System.Data.DataSet)"/> or <B>GetDeleteCommand</B>.
\r
1223 <member name="M:MySql.Data.MySqlClient.MySqlCommandBuilder.GetInsertCommand">
\r
1225 Gets the automatically generated <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> object
\r
1226 required to perform insertions on the database.
\r
1227 </summary><returns>
\r
1228 The <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> object generated to handle insert operations.
\r
1229 </returns><remarks>
\r
1231 An application can use the <B>GetInsertCommand</B> method for informational
\r
1232 or troubleshooting purposes because it returns the <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/>
\r
1233 object to be executed.
\r
1236 You can also use the <B>GetInsertCommand</B> as the basis of a modified command.
\r
1237 For example, you might call <B>GetInsertCommand</B> and modify the
\r
1238 <see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandTimeout"/> value, and then explicitly set that on the
\r
1239 <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/>.
\r
1242 After the SQL statement is first generated, the application must explicitly
\r
1243 call <see cref="M:MySql.Data.MySqlClient.MySqlCommandBuilder.RefreshSchema"/> if it changes the statement in any way.
\r
1244 Otherwise, the <B>GetInsertCommand</B> will be still be using information
\r
1245 from the previous statement, which might not be correct. The SQL statements
\r
1246 are first generated either when the application calls
\r
1247 <see cref="M:System.Data.Common.DataAdapter.Update(System.Data.DataSet)"/> or <B>GetInsertCommand</B>.
\r
1251 <member name="M:MySql.Data.MySqlClient.MySqlCommandBuilder.GetUpdateCommand">
\r
1253 Gets the automatically generated <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> object
\r
1254 required to perform updates on the database.
\r
1255 </summary><returns>
\r
1256 The <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> object generated to handle update operations.
\r
1257 </returns><remarks>
\r
1259 An application can use the <B>GetUpdateCommand</B> method for informational
\r
1260 or troubleshooting purposes because it returns the <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/>
\r
1261 object to be executed.
\r
1264 You can also use <B>GetUpdateCommand</B> as the basis of a modified command.
\r
1265 For example, you might call <B>GetUpdateCommand</B> and modify the
\r
1266 <see cref="P:MySql.Data.MySqlClient.MySqlCommand.CommandTimeout"/> value, and then explicitly set that on the
\r
1267 <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/>.
\r
1270 After the SQL statement is first generated, the application must explicitly
\r
1271 call <see cref="M:MySql.Data.MySqlClient.MySqlCommandBuilder.RefreshSchema"/> if it changes the statement in any way.
\r
1272 Otherwise, the <B>GetUpdateCommand</B> will be still be using information
\r
1273 from the previous statement, which might not be correct. The SQL statements
\r
1274 are first generated either when the application calls
\r
1275 <see cref="M:System.Data.Common.DataAdapter.Update(System.Data.DataSet)"/> or <B>GetUpdateCommand</B>.
\r
1279 <member name="M:MySql.Data.MySqlClient.MySqlCommandBuilder.RefreshSchema">
\r
1281 Refreshes the database schema information used to generate INSERT, UPDATE, or
\r
1282 DELETE statements.
\r
1283 </summary><remarks>
\r
1285 An application should call <B>RefreshSchema</B> whenever the SELECT statement
\r
1286 associated with the <see cref="T:MySql.Data.MySqlClient.MySqlCommandBuilder"/> changes.
\r
1289 An application should call <B>RefreshSchema</B> whenever the
\r
1290 <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/> value of the <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> changes.
\r
1294 <member name="P:MySql.Data.MySqlClient.MySqlCommandBuilder.DataAdapter">
\r
1296 Gets or sets a <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> object for which SQL statements are automatically generated.
\r
1298 A <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> object.
\r
1301 The <see cref="T:MySql.Data.MySqlClient.MySqlCommandBuilder"/> registers itself as a listener for
\r
1302 <see cref="E:MySql.Data.MySqlClient.MySqlDataAdapter.RowUpdating"/> events that are generated by the
\r
1303 <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> specified in this property.
\r
1306 When you create a new instance <B>MySqlCommandBuilder</B>, any existing
\r
1307 <B>MySqlCommandBuilder</B> associated with this <B>MySqlDataAdapter</B>
\r
1312 <member name="P:MySql.Data.MySqlClient.MySqlCommandBuilder.QuotePrefix">
\r
1314 Gets or sets the beginning character or characters to use when specifying MySQL
\r
1315 database objects (for example, tables or columns) whose names contain
\r
1316 characters such as spaces or reserved tokens.
\r
1318 The beginning character or characters to use. The default value is `.
\r
1320 Database objects in MySQL can contain special characters such as spaces that would
\r
1321 make normal SQL strings impossible to correctly parse. Use of the <b>QuotePrefix</b>
\r
1322 and the <see cref="P:MySql.Data.MySqlClient.MySqlCommandBuilder.QuoteSuffix"/> properties allows the <see cref="T:MySql.Data.MySqlClient.MySqlCommandBuilder"/>
\r
1323 to build SQL commands that handle this situation.
\r
1326 <member name="P:MySql.Data.MySqlClient.MySqlCommandBuilder.QuoteSuffix">
\r
1328 Gets or sets the beginning character or characters to use when specifying MySQL
\r
1329 database objects (for example, tables or columns) whose names contain
\r
1330 characters such as spaces or reserved tokens.
\r
1332 The beginning character or characters to use. The default value is `.
\r
1334 Database objects in MySQL can contain special characters such as spaces that would
\r
1335 make normal SQL strings impossible to correctly parse. Use of the <see cref="P:MySql.Data.MySqlClient.MySqlCommandBuilder.QuotePrefix"/>
\r
1336 and the <b>QuoteSuffix</b> properties allows the <see cref="T:MySql.Data.MySqlClient.MySqlCommandBuilder"/>
\r
1337 to build SQL commands that handle this situation.
\r
1340 <member name="T:MySql.Data.MySqlClient.CommandResult">
\r
1342 Summary description for CommandResult.
1345 <member name="M:MySql.Data.MySqlClient.CommandResult.Load">
\r
1351 <member name="M:MySql.Data.MySqlClient.CommandResult.ReadDataRow(System.Boolean)">
\r
1357 <member name="M:MySql.Data.MySqlClient.CommandResult.Consume">
\r
1362 <member name="T:MySql.Data.MySqlClient.CompressedStream">
\r
1364 Summary description for CompressedStream.
1367 <member name="T:MySql.Data.MySqlClient.MySqlConnection">
\r
1369 Represents an open connection to a MySQL Server database. This class cannot be inherited.
\r
1370 </summary><remarks>
\r
1372 A <b>MySqlConnection</b> object represents a session to a MySQL Server
\r
1373 data source. When you create an instance of <B>MySqlConnection</B>, all
\r
1374 properties are set to their initial values. For a list of these values, see the
\r
1375 <B>MySqlConnection</B> constructor.
\r
1379 If the <B>MySqlConnection</B> goes out of scope, it is not closed. Therefore,
\r
1380 you must explicitly close the connection by calling <see cref="M:MySql.Data.MySqlClient.MySqlConnection.Close"/>
\r
1381 or <see cref="M:MySql.Data.MySqlClient.MySqlConnection.Dispose(System.Boolean)"/>.
\r
1383 </remarks><example>
\r
1384 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> and
\r
1385 a <B>MySqlConnection</B>. The <B>MySqlConnection</B> is opened and set as the
\r
1386 <see cref="P:MySql.Data.MySqlClient.MySqlCommand.Connection"/> for the <B>MySqlCommand</B>. The example then calls
\r
1387 <see cref="M:MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery"/>, and closes the connection. To accomplish this, the <B>ExecuteNonQuery</B> is
\r
1388 passed a connection string and a query string that is a SQL INSERT
\r
1390 <code lang="Visual Basic">
\r
1392 Public Sub InsertRow(myConnectionString As String)
\r
1393 ' If the connection string is null, use a default.
\r
1394 If myConnectionString = "" Then
\r
1395 myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"
\r
1397 Dim myConnection As New MySqlConnection(myConnectionString)
\r
1398 Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"
\r
1399 Dim myCommand As New MySqlCommand(myInsertQuery)
\r
1400 myCommand.Connection = myConnection
\r
1401 myConnection.Open()
\r
1402 myCommand.ExecuteNonQuery()
\r
1403 myCommand.Connection.Close()
\r
1409 public void InsertRow(string myConnectionString)
\r
1411 // If the connection string is null, use a default.
\r
1412 if(myConnectionString == "")
\r
1414 myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass";
\r
1416 MySqlConnection myConnection = new MySqlConnection(myConnectionString);
\r
1417 string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)";
\r
1418 MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
\r
1419 myCommand.Connection = myConnection;
\r
1420 myConnection.Open();
\r
1421 myCommand.ExecuteNonQuery();
\r
1422 myCommand.Connection.Close();
\r
1428 <member name="M:MySql.Data.MySqlClient.MySqlConnection.#ctor">
\r
1429 <summary>Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> class.</summary><remarks>
\r
1430 When a new instance of <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> is created, the read/write
\r
1431 properties are set to the following initial values unless they are specifically
\r
1432 set using their associated keywords in the <see cref="P:MySql.Data.MySqlClient.MySqlConnection.ConnectionString"/> property.
\r
1434 <list type="table">
\r
1435 <listheader><term>Properties</term><term>Initial Value</term></listheader>
\r
1436 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlConnection.ConnectionString"/></term><term>empty string ("")</term></item>
\r
1437 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlConnection.ConnectionTimeout"/></term><term>15</term></item>
\r
1438 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlConnection.Database"/></term><term>empty string ("")</term></item>
\r
1439 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlConnection.DataSource"/></term><term>empty string ("")</term></item>
\r
1440 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlConnection.ServerVersion"/></term><term>empty string ("")</term></item>
\r
1443 You can change the value for these properties only by using the <B>ConnectionString</B> property.
\r
1444 </remarks><example>
\r
1445 </example><overloads>
\r
1446 <summary>Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> class.</summary>
\r
1449 <member name="M:MySql.Data.MySqlClient.MySqlConnection.#ctor(System.String)">
\r
1450 <summary>Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> class when given a string containing the connection string.</summary><remarks>
\r
1451 When a new instance of <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> is created, the read/write
\r
1452 properties are set to the following initial values unless they are specifically
\r
1453 set using their associated keywords in the <see cref="P:MySql.Data.MySqlClient.MySqlConnection.ConnectionString"/> property.
\r
1455 <list type="table">
\r
1456 <listheader><term>Properties</term><term>Initial Value</term></listheader>
\r
1457 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlConnection.ConnectionString"/></term><term>empty string ("")</term></item>
\r
1458 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlConnection.ConnectionTimeout"/></term><term>15</term></item>
\r
1459 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlConnection.Database"/></term><term>empty string ("")</term></item>
\r
1460 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlConnection.DataSource"/></term><term>empty string ("")</term></item>
\r
1461 <item><term><see cref="P:MySql.Data.MySqlClient.MySqlConnection.ServerVersion"/></term><term>empty string ("")</term></item>
\r
1464 You can change the value for these properties only by using the <B>ConnectionString</B> property.
\r
1465 </remarks><example>
\r
1466 </example><param name="connectionString">The connection properties used to open the MySQL database. </param>
\r
1468 <member name="M:MySql.Data.MySqlClient.MySqlConnection.BeginTransaction">
\r
1469 <summary>Begins a database transaction.</summary><returns>An object representing the new transaction.</returns><exception cref="T:System.InvalidOperationException">Parallel transactions are not supported.</exception><remarks>
\r
1470 <para>This command is equivalent to the MySQL BEGIN TRANSACTION command.</para>
\r
1471 <para>You must explicitly commit or roll back the transaction using the <see cref="M:MySql.Data.MySqlClient.MySqlTransaction.Commit"/> or
\r
1472 <see cref="M:MySql.Data.MySqlClient.MySqlTransaction.Rollback"/> method.
\r
1473 <note>If you do not specify an isolation level, the default isolation level is used. To specify an isolation
\r
1474 level with the <see cref="M:MySql.Data.MySqlClient.MySqlConnection.BeginTransaction"/> method, use the overload that takes the <I>iso</I> parameter.
\r
1476 </remarks><example>
\r
1477 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> and a
\r
1478 <see cref="T:MySql.Data.MySqlClient.MySqlTransaction"/>. It also demonstrates how to use the <B>BeginTransaction</B>, a
\r
1479 <see cref="M:MySql.Data.MySqlClient.MySqlTransaction.Commit"/>, and <see cref="M:MySql.Data.MySqlClient.MySqlTransaction.Rollback"/> methods.
\r
1480 <code lang="Visual Basic">
\r
1481 Public Sub RunTransaction(myConnString As String)
\r
1482 Dim myConnection As New MySqlConnection(myConnString)
\r
1483 myConnection.Open()
\r
1485 Dim myCommand As MySqlCommand = myConnection.CreateCommand()
\r
1486 Dim myTrans As MySqlTransaction
\r
1488 ' Start a local transaction
\r
1489 myTrans = myConnection.BeginTransaction()
\r
1490 ' Must assign both transaction object and connection
\r
1491 ' to Command object for a pending local transaction
\r
1492 myCommand.Connection = myConnection
\r
1493 myCommand.Transaction = myTrans
\r
1496 myCommand.CommandText = "Insert into Test (id, desc) VALUES (100, 'Description')"
\r
1497 myCommand.ExecuteNonQuery()
\r
1498 myCommand.CommandText = "Insert into Test (id, desc) VALUES (101, 'Description')"
\r
1499 myCommand.ExecuteNonQuery()
\r
1501 Console.WriteLine("Both records are written to database.")
\r
1502 Catch e As Exception
\r
1504 myTrans.Rollback()
\r
1505 Catch ex As MySqlException
\r
1506 If Not myTrans.Connection Is Nothing Then
\r
1507 Console.WriteLine("An exception of type " + ex.GetType().ToString() + _
\r
1508 " was encountered while attempting to roll back the transaction.")
\r
1512 Console.WriteLine("An exception of type " + e.GetType().ToString() + _
\r
1513 "was encountered while inserting the data.")
\r
1514 Console.WriteLine("Neither record was written to database.")
\r
1516 myConnection.Close()
\r
1521 public void RunTransaction(string myConnString)
\r
1523 MySqlConnection myConnection = new MySqlConnection(myConnString);
\r
1524 myConnection.Open();
\r
1526 MySqlCommand myCommand = myConnection.CreateCommand();
\r
1527 MySqlTransaction myTrans;
\r
1529 // Start a local transaction
\r
1530 myTrans = myConnection.BeginTransaction();
\r
1531 // Must assign both transaction object and connection
\r
1532 // to Command object for a pending local transaction
\r
1533 myCommand.Connection = myConnection;
\r
1534 myCommand.Transaction = myTrans;
\r
1538 myCommand.CommandText = "insert into Test (id, desc) VALUES (100, 'Description')";
\r
1539 myCommand.ExecuteNonQuery();
\r
1540 myCommand.CommandText = "insert into Test (id, desc) VALUES (101, 'Description')";
\r
1541 myCommand.ExecuteNonQuery();
\r
1543 Console.WriteLine("Both records are written to database.");
\r
1545 catch(Exception e)
\r
1549 myTrans.Rollback();
\r
1551 catch (SqlException ex)
\r
1553 if (myTrans.Connection != null)
\r
1555 Console.WriteLine("An exception of type " + ex.GetType() +
\r
1556 " was encountered while attempting to roll back the transaction.");
\r
1560 Console.WriteLine("An exception of type " + e.GetType() +
\r
1561 " was encountered while inserting the data.");
\r
1562 Console.WriteLine("Neither record was written to database.");
\r
1566 myConnection.Close();
\r
1572 <member name="M:MySql.Data.MySqlClient.MySqlConnection.BeginTransaction(System.Data.IsolationLevel)">
\r
1573 <summary>Begins a database transaction with the specified isolation level.</summary><param name="iso">The isolation level under which the transaction should run. </param><returns>An object representing the new transaction.</returns><exception cref="T:System.InvalidOperationException">Parallel exceptions are not supported.</exception><remarks>
\r
1574 <para>This command is equivalent to the MySQL BEGIN TRANSACTION command.</para>
\r
1575 <para>You must explicitly commit or roll back the transaction using the <see cref="M:MySql.Data.MySqlClient.MySqlTransaction.Commit"/> or
\r
1576 <see cref="M:MySql.Data.MySqlClient.MySqlTransaction.Rollback"/> method.
\r
1577 <note>If you do not specify an isolation level, the default isolation level is used. To specify an isolation
\r
1578 level with the <see cref="M:MySql.Data.MySqlClient.MySqlConnection.BeginTransaction"/> method, use the overload that takes the <I>iso</I> parameter.
\r
1580 </remarks><example>
\r
1581 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> and a
\r
1582 <see cref="T:MySql.Data.MySqlClient.MySqlTransaction"/>. It also demonstrates how to use the <B>BeginTransaction</B>, a
\r
1583 <see cref="M:MySql.Data.MySqlClient.MySqlTransaction.Commit"/>, and <see cref="M:MySql.Data.MySqlClient.MySqlTransaction.Rollback"/> methods.
\r
1584 <code lang="Visual Basic">
\r
1585 Public Sub RunTransaction(myConnString As String)
\r
1586 Dim myConnection As New MySqlConnection(myConnString)
\r
1587 myConnection.Open()
\r
1589 Dim myCommand As MySqlCommand = myConnection.CreateCommand()
\r
1590 Dim myTrans As MySqlTransaction
\r
1592 ' Start a local transaction
\r
1593 myTrans = myConnection.BeginTransaction()
\r
1594 ' Must assign both transaction object and connection
\r
1595 ' to Command object for a pending local transaction
\r
1596 myCommand.Connection = myConnection
\r
1597 myCommand.Transaction = myTrans
\r
1600 myCommand.CommandText = "Insert into Test (id, desc) VALUES (100, 'Description')"
\r
1601 myCommand.ExecuteNonQuery()
\r
1602 myCommand.CommandText = "Insert into Test (id, desc) VALUES (101, 'Description')"
\r
1603 myCommand.ExecuteNonQuery()
\r
1605 Console.WriteLine("Both records are written to database.")
\r
1606 Catch e As Exception
\r
1608 myTrans.Rollback()
\r
1609 Catch ex As MySqlException
\r
1610 If Not myTrans.Connection Is Nothing Then
\r
1611 Console.WriteLine("An exception of type " + ex.GetType().ToString() + _
\r
1612 " was encountered while attempting to roll back the transaction.")
\r
1616 Console.WriteLine("An exception of type " + e.GetType().ToString() + _
\r
1617 "was encountered while inserting the data.")
\r
1618 Console.WriteLine("Neither record was written to database.")
\r
1620 myConnection.Close()
\r
1625 public void RunTransaction(string myConnString)
\r
1627 MySqlConnection myConnection = new MySqlConnection(myConnString);
\r
1628 myConnection.Open();
\r
1630 MySqlCommand myCommand = myConnection.CreateCommand();
\r
1631 MySqlTransaction myTrans;
\r
1633 // Start a local transaction
\r
1634 myTrans = myConnection.BeginTransaction();
\r
1635 // Must assign both transaction object and connection
\r
1636 // to Command object for a pending local transaction
\r
1637 myCommand.Connection = myConnection;
\r
1638 myCommand.Transaction = myTrans;
\r
1642 myCommand.CommandText = "insert into Test (id, desc) VALUES (100, 'Description')";
\r
1643 myCommand.ExecuteNonQuery();
\r
1644 myCommand.CommandText = "insert into Test (id, desc) VALUES (101, 'Description')";
\r
1645 myCommand.ExecuteNonQuery();
\r
1647 Console.WriteLine("Both records are written to database.");
\r
1649 catch(Exception e)
\r
1653 myTrans.Rollback();
\r
1655 catch (SqlException ex)
\r
1657 if (myTrans.Connection != null)
\r
1659 Console.WriteLine("An exception of type " + ex.GetType() +
\r
1660 " was encountered while attempting to roll back the transaction.");
\r
1664 Console.WriteLine("An exception of type " + e.GetType() +
\r
1665 " was encountered while inserting the data.");
\r
1666 Console.WriteLine("Neither record was written to database.");
\r
1670 myConnection.Close();
\r
1676 <member name="M:MySql.Data.MySqlClient.MySqlConnection.ChangeDatabase(System.String)">
\r
1677 <summary>Changes the current database for an open MySqlConnection.</summary><param name="databaseName">The name of the database to use.</param><remarks>
\r
1678 <para>The value supplied in the <I>database</I> parameter must be a valid database
\r
1679 name. The <I>database</I> parameter cannot contain a null value, an empty
\r
1680 string, or a string with only blank characters.</para>
\r
1682 <para>When you are using connection pooling against MySQL, and you close
\r
1683 the connection, it is returned to the connection pool. The next time the
\r
1684 connection is retrieved from the pool, the reset connection request
\r
1685 executes before the user performs any operations.</para>
\r
1686 </remarks><exception cref="T:System.ArgumentException">The database name is not valid.</exception><exception cref="T:System.InvalidOperationException">The connection is not open.</exception><exception cref="T:MySql.Data.MySqlClient.MySqlException">Cannot change the database.</exception><example>
\r
1687 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> and displays
\r
1688 some of its read-only properties.
\r
1690 <code lang="Visual Basic">
\r
1691 Public Sub CreateMySqlConnection()
\r
1692 Dim myConnString As String = _
\r
1693 "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass"
\r
1694 Dim myConnection As New MySqlConnection( myConnString )
\r
1695 myConnection.Open()
\r
1696 MessageBox.Show( "Server Version: " + myConnection.ServerVersion _
\r
1697 + ControlChars.NewLine + "Database: " + myConnection.Database )
\r
1698 myConnection.ChangeDatabase( "test2" )
\r
1699 MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion _
\r
1700 + ControlChars.NewLine + "Database: " + myConnection.Database )
\r
1701 myConnection.Close()
\r
1706 public void CreateMySqlConnection()
\r
1708 string myConnString =
\r
1709 "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass";
\r
1710 MySqlConnection myConnection = new MySqlConnection( myConnString );
\r
1711 myConnection.Open();
\r
1712 MessageBox.Show( "Server Version: " + myConnection.ServerVersion
\r
1713 + "\nDatabase: " + myConnection.Database );
\r
1714 myConnection.ChangeDatabase( "test2" );
\r
1715 MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion
\r
1716 + "\nDatabase: " + myConnection.Database );
\r
1717 myConnection.Close();
\r
1722 <member name="M:MySql.Data.MySqlClient.MySqlConnection.Ping">
\r
1728 <member name="M:MySql.Data.MySqlClient.MySqlConnection.Open">
\r
1729 <summary>Opens a database connection with the property settings specified by the ConnectionString.</summary><exception cref="T:System.InvalidOperationException">Cannot open a connection without specifying a data source or server.</exception><exception cref="T:MySql.Data.MySqlClient.MySqlException">A connection-level error occurred while opening the connection.</exception><remarks>
\r
1730 <para>The <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> draws an open connection from the connection pool if one is available.
\r
1731 Otherwise, it establishes a new connection to an instance of MySQL.</para>
\r
1732 </remarks><example>
\r
1733 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>, opens it,
\r
1734 displays some of its properties, then closes the connection.
\r
1736 <code lang="Visual Basic">
\r
1737 Public Sub CreateMySqlConnection(myConnString As String)
\r
1738 Dim myConnection As New MySqlConnection(myConnString)
\r
1739 myConnection.Open()
\r
1740 MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
\r
1741 + ControlChars.Cr + "State: " + myConnection.State.ToString())
\r
1742 myConnection.Close()
\r
1746 public void CreateMySqlConnection(string myConnString)
\r
1748 MySqlConnection myConnection = new MySqlConnection(myConnString);
\r
1749 myConnection.Open();
\r
1750 MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
\r
1751 "\nState: " + myConnection.State.ToString());
\r
1752 myConnection.Close();
\r
1757 <member name="M:MySql.Data.MySqlClient.MySqlConnection.Close">
\r
1758 <summary>Closes the connection to the database. This is the preferred method of closing any open connection.</summary><remarks>
\r
1759 <para>The <B>Close</B> method rolls back any pending transactions. It then releases
\r
1760 the connection to the connection pool, or closes the connection if connection
\r
1761 pooling is disabled.</para>
\r
1762 <para>An application can call <B>Close</B> more than one time. No exception is
\r
1764 </remarks><example>
\r
1765 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>, opens it,
\r
1766 displays some of its properties, then closes the connection.
\r
1768 <code lang="Visual Basic">
\r
1769 Public Sub CreateMySqlConnection(myConnString As String)
\r
1770 Dim myConnection As New MySqlConnection(myConnString)
\r
1771 myConnection.Open()
\r
1772 MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
\r
1773 + ControlChars.Cr + "State: " + myConnection.State.ToString())
\r
1774 myConnection.Close()
\r
1778 public void CreateMySqlConnection(string myConnString)
\r
1780 MySqlConnection myConnection = new MySqlConnection(myConnString);
\r
1781 myConnection.Open();
\r
1782 MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
\r
1783 "\nState: " + myConnection.State.ToString());
\r
1784 myConnection.Close();
\r
1789 <member name="M:MySql.Data.MySqlClient.MySqlConnection.CreateCommand">
\r
1790 <summary>Creates and returns a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> object associated with the <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>.</summary><returns>A <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> object.</returns>
\r
1792 <member name="M:MySql.Data.MySqlClient.MySqlConnection.System#ICloneable#Clone">
\r
1794 Creates a new MySqlConnection object with the exact same ConnectionString value
1796 <returns>A cloned MySqlConnection object</returns>
1798 <member name="M:MySql.Data.MySqlClient.MySqlConnection.Dispose(System.Boolean)">
\r
1800 Releases the resources used by the MySqlConnection.
1803 <member name="E:MySql.Data.MySqlClient.MySqlConnection.StateChange">
\r
1804 <summary>Occurs when the state of the connection changes.</summary><remarks>
\r
1805 <para>The <B>StateChange</B> event fires whenever the <see cref="P:MySql.Data.MySqlClient.MySqlConnection.State"/> changes from
\r
1806 closed to opened, or from opened to closed. <B>StateChange</B> fires immediately
\r
1807 after the <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> transitions.</para>
\r
1809 <para>If an event handler throws an exception from within the <B>StateChange</B>
\r
1810 event, the exception propagates to the caller of the <see cref="M:MySql.Data.MySqlClient.MySqlConnection.Open"/> or
\r
1811 <see cref="M:MySql.Data.MySqlClient.MySqlConnection.Close"/> method.</para>
\r
1813 <para>The <B>StateChange</B> event is not raised unless you explicitly call
\r
1814 <B>Close</B> or <B>Dispose</B>.</para>
\r
1815 </remarks><event cref="E:MySql.Data.MySqlClient.MySqlConnection.StateChange">
\r
1818 <para>The event handler receives an argument of type <see cref="T:System.Data.StateChangeEventArgs"/>
\r
1819 containing data related to this event. The following <B>StateChangeEventArgs</B>
\r
1820 properties provide information specific to this event.</para>
\r
1821 <list type="table">
\r
1823 <term>Property</term>
\r
1824 <description>Description</description>
\r
1827 <term><see cref="P:System.Data.StateChangeEventArgs.CurrentState"/></term>
\r
1828 <description>Gets the new state of the connection. The connection object will
\r
1829 be in the new state already when the event is fired.</description>
\r
1832 <term><see cref="P:System.Data.StateChangeEventArgs.OriginalState"/></term>
\r
1833 <description>Gets the original state of the connection.</description>
\r
1839 <member name="E:MySql.Data.MySqlClient.MySqlConnection.InfoMessage">
\r
1840 <summary>Occurs when MySQL returns warnings as a result of executing a command or query.</summary><remarks>
\r
1843 <member name="P:MySql.Data.MySqlClient.MySqlConnection.ServerThread">
\r
1845 Returns the id of the server thread this connection is executing on
\r
1848 <member name="P:MySql.Data.MySqlClient.MySqlConnection.DataSource">
\r
1850 Gets the name of the MySQL server to which to connect.
1853 <member name="P:MySql.Data.MySqlClient.MySqlConnection.ConnectionTimeout">
\r
1855 Gets the time to wait while trying to establish a connection before terminating the attempt and generating an error.
\r
1856 </summary><exception cref="T:System.ArgumentException">The value set is less than 0.</exception><remarks>
\r
1857 A value of 0 indicates no limit, and should be avoided in a
\r
1858 <see cref="P:MySql.Data.MySqlClient.MySqlConnection.ConnectionString"/> because an attempt to connect
\r
1859 will wait indefinitely.
\r
1860 </remarks><example>
\r
1861 The following example creates a MySqlConnection
\r
1862 and sets some of its properties in the connection string.
\r
1863 <code lang="Visual Basic">
\r
1864 Public Sub CreateSqlConnection()
\r
1865 Dim myConnection As New MySqlConnection()
\r
1866 myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30"
\r
1867 myConnection.Open()
\r
1871 public void CreateSqlConnection()
\r
1873 MySqlConnection myConnection = new MySqlConnection();
\r
1874 myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30";
\r
1875 myConnection.Open();
\r
1880 <member name="P:MySql.Data.MySqlClient.MySqlConnection.Database">
\r
1881 <summary>Gets the name of the current database or the database to be used after a connection is opened.</summary><returns>The name of the current database or the name of the database to be used after a connection is opened. The default value is an empty string.</returns><remarks>
\r
1882 <para>The <B>Database</B> property does not update dynamically.
\r
1883 If you change the current database using a SQL statement, then this property
\r
1884 may reflect the wrong value. If you change the current database using the <see cref="M:MySql.Data.MySqlClient.MySqlConnection.ChangeDatabase(System.String)"/>
\r
1885 method, this property is updated to reflect the new database.</para>
\r
1886 </remarks><example>
\r
1887 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> and displays
\r
1888 some of its read-only properties.
\r
1890 <code lang="Visual Basic">
\r
1891 Public Sub CreateMySqlConnection()
\r
1892 Dim myConnString As String = _
\r
1893 "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass"
\r
1894 Dim myConnection As New MySqlConnection( myConnString )
\r
1895 myConnection.Open()
\r
1896 MessageBox.Show( "Server Version: " + myConnection.ServerVersion _
\r
1897 + ControlChars.NewLine + "Database: " + myConnection.Database )
\r
1898 myConnection.ChangeDatabase( "test2" )
\r
1899 MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion _
\r
1900 + ControlChars.NewLine + "Database: " + myConnection.Database )
\r
1901 myConnection.Close()
\r
1906 public void CreateMySqlConnection()
\r
1908 string myConnString =
\r
1909 "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass";
\r
1910 MySqlConnection myConnection = new MySqlConnection( myConnString );
\r
1911 myConnection.Open();
\r
1912 MessageBox.Show( "Server Version: " + myConnection.ServerVersion
\r
1913 + "\nDatabase: " + myConnection.Database );
\r
1914 myConnection.ChangeDatabase( "test2" );
\r
1915 MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion
\r
1916 + "\nDatabase: " + myConnection.Database );
\r
1917 myConnection.Close();
\r
1922 <member name="P:MySql.Data.MySqlClient.MySqlConnection.UseCompression">
\r
1924 Indicates if this connection should use compression when communicating with the server.
1927 <member name="P:MySql.Data.MySqlClient.MySqlConnection.State">
\r
1928 <summary>Gets the current state of the connection.</summary><returns>A bitwise combination of the <see cref="T:System.Data.ConnectionState"/> values. The default is <B>Closed</B>.</returns><remarks>
\r
1929 The allowed state changes are:
\r
1930 <list type="bullet">
\r
1931 <item>From <B>Closed</B> to <B>Open</B>, using the <B>Open</B> method of the connection object.</item>
\r
1932 <item>From <B>Open</B> to <B>Closed</B>, using either the <B>Close</B> method or the <B>Dispose</B> method of the connection object. </item>
\r
1934 </remarks><example>
\r
1935 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>, opens it,
\r
1936 displays some of its properties, then closes the connection.
\r
1938 <code lang="Visual Basic">
\r
1939 Public Sub CreateMySqlConnection(myConnString As String)
\r
1940 Dim myConnection As New MySqlConnection(myConnString)
\r
1941 myConnection.Open()
\r
1942 MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
\r
1943 + ControlChars.Cr + "State: " + myConnection.State.ToString())
\r
1944 myConnection.Close()
\r
1948 public void CreateMySqlConnection(string myConnString)
\r
1950 MySqlConnection myConnection = new MySqlConnection(myConnString);
\r
1951 myConnection.Open();
\r
1952 MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
\r
1953 "\nState: " + myConnection.State.ToString());
\r
1954 myConnection.Close();
\r
1959 <member name="P:MySql.Data.MySqlClient.MySqlConnection.ServerVersion">
\r
1960 <summary>Gets a string containing the version of the MySQL server to which the client is connected.</summary><returns>The version of the instance of MySQL.</returns><exception cref="T:System.InvalidOperationException">The connection is closed.</exception><example>
\r
1961 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>, opens it,
\r
1962 displays some of its properties, then closes the connection.
\r
1964 <code lang="Visual Basic">
\r
1965 Public Sub CreateMySqlConnection(myConnString As String)
\r
1966 Dim myConnection As New MySqlConnection(myConnString)
\r
1967 myConnection.Open()
\r
1968 MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
\r
1969 + ControlChars.Cr + "State: " + myConnection.State.ToString())
\r
1970 myConnection.Close()
\r
1974 public void CreateMySqlConnection(string myConnString)
\r
1976 MySqlConnection myConnection = new MySqlConnection(myConnString);
\r
1977 myConnection.Open();
\r
1978 MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
\r
1979 "\nState: " + myConnection.State.ToString());
\r
1980 myConnection.Close();
\r
1985 <member name="P:MySql.Data.MySqlClient.MySqlConnection.ConnectionString">
\r
1987 Gets or sets the string used to connect to a MySQL Server database.
\r
1988 </summary><remarks>
\r
1989 <para>The <B>ConnectionString</B> returned may not be exactly like what was originally
\r
1990 set but will be indentical in terms of keyword/value pairs. Security information
\r
1991 will not be included unless the Persist Security Info value is set to true.
\r
1993 <para>You can use the <B>ConnectionString</B> property to connect to a database.
\r
1994 The following example illustrates a typical connection string.</para>
\r
1995 <c>"Persist Security Info=False;database=MyDB;server=MySqlServer;user id=myUser;Password=myPass"</c>
\r
1996 <para>The <B>ConnectionString</B> property can be set only when the connection is
\r
1997 closed. Many of the connection string values have corresponding read-only
\r
1998 properties. When the connection string is set, all of these properties are
\r
1999 updated, except when an error is detected. In this case, none of the properties
\r
2000 are updated. <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> properties return only those settings contained in the
\r
2001 <B>ConnectionString</B>.</para>
\r
2002 <para>To connect to a local machine, specify "localhost" for the server. If you do not
\r
2003 specify a server, localhost is assumed.</para>
\r
2004 <para>Resetting the <B>ConnectionString</B> on a closed connection resets all
\r
2005 connection string values (and related properties) including the password. For
\r
2006 example, if you set a connection string that includes "Database= MyDb", and
\r
2007 then reset the connection string to "Data Source=myserver;User Id=myUser;Password=myPass",
\r
2008 the <see cref="P:MySql.Data.MySqlClient.MySqlConnection.Database"/> property is no longer set to MyDb.</para>
\r
2009 <para>The connection string is parsed immediately after being set. If errors in
\r
2010 syntax are found when parsing, a runtime exception, such as <see cref="T:System.ArgumentException"/>,
\r
2011 is generated. Other errors can be found only when an attempt is made to open the
\r
2012 connection.</para>
\r
2013 <para>The basic format of a connection string consists of a series of keyword/value
\r
2014 pairs separated by semicolons. The equal sign (=) connects each keyword and its
\r
2015 value. To include values that contain a semicolon, single-quote character, or
\r
2016 double-quote character, the value must be enclosed in double quotes. If the
\r
2017 value contains both a semicolon and a double-quote character, the value can be
\r
2018 enclosed in single quotes. The single quote is also useful if the value begins
\r
2019 with a double-quote character. Conversely, the double quote can be used if the
\r
2020 value begins with a single quote. If the value contains both single-quote and
\r
2021 double-quote characters, the quote character used to enclose the value must be
\r
2022 doubled each time it occurs within the value.</para>
\r
2023 <para>To include preceding or trailing spaces in the string value, the value must
\r
2024 be enclosed in either single quotes or double quotes. Any leading or trailing
\r
2025 spaces around integer, Boolean, or enumerated values are ignored, even if
\r
2026 enclosed in quotes. However, spaces within a string literal keyword or value are
\r
2027 preserved. Using .NET Framework version 1.1, single or double quotes may be used
\r
2028 within a connection string without using delimiters (for example, Data Source=
\r
2029 my'Server or Data Source= my"Server), unless a quote character is the first or
\r
2030 last character in the value.</para>
\r
2031 <para>To include an equal sign (=) in a keyword or value, it must be preceded by
\r
2032 another equal sign. For example, in the hypothetical connection string</para>
\r
2033 <c>"key==word=value"</c>
\r
2035 <para>the keyword is "key=word" and the value is "value".</para>
\r
2036 <para>If a specific keyword in a keyword= value pair occurs multiple times in a
\r
2037 connection string, the last occurrence listed is used in the value set.</para>
\r
2038 <para>Keywords are not case sensitive.</para>
\r
2039 <para>The following table lists the valid names for keyword values within the
\r
2040 <B>ConnectionString</B>.</para>
\r
2042 <div class="tablediv"><table class="dtTABLE" cellspacing="0"><tr valign="top">
\r
2043 <th width="33%">Name</th>
\r
2044 <th width="33%">Default</th>
\r
2045 <th width="33%">Description</th>
\r
2048 <td>Connect Timeout<para> -or- </para>Connection Timeout</td>
\r
2050 <td>The length of time (in seconds) to wait for a connection to the server before
\r
2051 terminating the attempt and generating an error.</td>
\r
2055 Host<para> -or- </para>Server<para> -or- </para>Data Source<para> -or- </para>
\r
2056 DataSource<para> -or- </para>Address<para> -or- </para>Addr<para> -or- </para>
\r
2059 <td>localhost</td>
\r
2060 <td><para>The name or network address of the instance of MySQL to which to connect. Multiple hosts can be
\r
2061 specified separated by &. This can be useful where multiple MySQL servers are configured for replication
\r
2062 and you are not concerned about the precise server you are connecting to. No attempt is made by the provider to
\r
2063 synchronize writes to the database so care should be taken when using this option.
\r
2066 In Unix environment with Mono, this can be a fully qualified path to MySQL socket filename. With this configuration, the Unix socket will be used instead of TCP/IP socket.
\r
2067 Currently only a single socket name can be given so accessing MySQL in a replicated environment using Unix sockets is not currently supported.
\r
2074 <td>The port MySQL is using to listen for connections. Specify -1 for this value to use a
\r
2075 named pipe connection (Windows only). This value is ignored if Unix socket is used.</td>
\r
2081 Specifies the type of connection to make to the server.<para>Values can be:</para>
\r
2082 socket or tcp for a socket connection<br/>
\r
2083 pipe for a named pipe connection<br/>
\r
2084 unix for a Unix socket connection<br/>
\r
2085 memory to use MySQL shared memory
\r
2089 <td>CharSet<para> -or </para>Character Set</td>
\r
2092 Specifies the character set that should be used to encode all queries sent to the server.
\r
2093 Resultsets are still returned in the character set of the data returned.
\r
2099 <td>When true, various pieces of information is output to any configured TraceListeners.</td>
\r
2102 <td>Allow Batch</td>
\r
2105 When true, multiple SQL statements can be sent with one command execution.<br/><br/>
\r
2107 Starting with MySQL 4.1.1, batch statements should be separated by the server-defined seperator character.<br/>
\r
2108 Commands sent to earlier versions of MySQL should be seperated with ';'.
\r
2114 <td>When <B>true</B>, SSL encryption is used for all data sent between the
\r
2115 client and server if the server has a certificate installed. Recognized values
\r
2116 are <B>true</B>, <B>false</B>, <B>yes</B>, and <B>no</B>.<para><b>Note</b> This parameter currently has no
\r
2117 effect.</para></td>
\r
2120 <td>Initial Catalog<para> -or- </para>Database</td>
\r
2122 <td>The name of the database to use intially</td>
\r
2125 <td>Password<para> -or- </para>pwd</td>
\r
2127 <td>The password for the MySQL account being used.</td>
\r
2130 <td>Persist Security Info</td>
\r
2132 <td>When set to <B>false</B> or <B>no</B> (strongly recommended), security-sensitive
\r
2133 information, such as the password, is not returned as part of the connection if
\r
2134 the connection is open or has ever been in an open state. Resetting the
\r
2135 connection string resets all connection string values including the password.
\r
2136 Recognized values are <B>true</B>, <B>false</B>, <B>yes</B>, and <B>no</B>.</td>
\r
2139 <td>User Id<para> -or- </para>Username<para> -or- </para>Uid<para> -or- </para>User name</td>
\r
2141 <td>The MySQL login account being used.</td>
\r
2144 <td>Shared Memory Name</td>
\r
2146 <td>The name of the shared memory object to use for communication if the connection protocol is set to memory.</td>
\r
2149 <td>Allow Zero Datetime</td>
\r
2151 <td>True to have MySqlDataReader.GetValue() return a MySqlDateTime for date or datetime columns that have illegal values.
\r
2152 False will cause a DateTime object to be returned for legal values and an exception will be thrown for illegal values.</td>
\r
2155 <td>Convert Zero Datetime</td>
\r
2157 <td>True to have MySqlDataReader.GetValue() and MySqlDataReader.GetDateTime()
\r
2158 return DateTime.MinValue for date or datetime columns that have illegal values.</td>
\r
2161 <td>Old Syntax<para> -or- </para>OldSyntax</td>
\r
2164 Allows use of '@' symbol as a parameter marker. See <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> for more
\r
2166 <note>This is for compatibility only. All future code should be written to
\r
2167 use the new '?' parameter marker.</note>
\r
2171 <td>Pipe Name<para> -or- </para>Pipe</td>
\r
2173 <td>When set to the name of a named pipe, the <B>MySqlConnection</B> will attempt to connect to MySQL
\r
2174 on that named pipe.<br/><br/>This settings only applies to the Windows platform.</td>
\r
2179 The following table lists the valid names for connection pooling values within
\r
2180 the <B>ConnectionString</B>. For more information about connection pooling, see
\r
2181 Connection Pooling for the MySql Data Provider.</para>
\r
2182 <div class="tablediv"><table class="dtTABLE" cellspacing="0"><tr valign="top">
\r
2183 <th width="33%">Name</th>
\r
2184 <th width="33%">Default</th>
\r
2185 <th width="33%">Description</th>
\r
2188 <td>Connection Lifetime</td>
\r
2190 <td>When a connection is returned to the pool, its creation time is compared with
\r
2191 the current time, and the connection is destroyed if that time span (in seconds)
\r
2192 exceeds the value specified by <B>Connection Lifetime</B>. This is useful in
\r
2193 clustered configurations to force load balancing between a running server and a
\r
2194 server just brought online.
\r
2195 <para>A value of zero (0) causes pooled connections to have the maximum connection
\r
2196 timeout.</para></td>
\r
2199 <td>Max Pool Size</td>
\r
2201 <td>The maximum number of connections allowed in the pool.</td>
\r
2204 <td>Min Pool Size</td>
\r
2206 <td>The minimum number of connections allowed in the pool.</td>
\r
2211 <td>When <B>true</B>, the <B>MySqlConnection</B> object is drawn from the appropriate
\r
2212 pool, or if necessary, is created and added to the appropriate pool. Recognized
\r
2213 values are <B>true</B>, <B>false</B>, <B>yes</B>, and <B>no</B>.</td>
\r
2216 <td>Reset Pooled Connections<para> -or- </para>
\r
2217 ResetConnections<para> -or- </para>
\r
2218 ResetPooledConnections</td>
\r
2220 <td>Specifies whether a ping and a reset should be sent to the server
\r
2221 before a pooled connection is returned. Not resetting will yeild faster
\r
2222 connection opens but also will not clear out session items such as
\r
2226 <td>Cache Server Configuration<para> -or- </para>
\r
2227 CacheServerConfiguration<para> -or- </para>
\r
2228 CacheServerConfig</td>
\r
2230 <td>Specifies whether server variables should be updated when a pooled
\r
2231 connection is returned. Turning this one will yeild faster opens but
\r
2232 will also not catch any server changes made by other connections.</td>
\r
2235 <para>When setting keyword or connection pooling values that require a Boolean
\r
2236 value, you can use 'yes' instead of 'true', and 'no' instead of 'false'.</para>
\r
2237 <para><B>Note</B> The MySql Data Provider uses the native socket protocol to
\r
2238 communicate with MySQL. Therefore, it does not support the use of an ODBC data source name (DSN) when
\r
2239 connecting to MySQL because it does not add an ODBC layer.</para>
\r
2240 <para><B>CAUTION</B> In this release, the application should use caution when constructing a
\r
2241 connection string based on user input (for example when retrieving user ID and password information from a
\r
2242 dialog box, and appending it to the connection string). The application should
\r
2243 ensure that a user cannot embed extra connection string parameters in these
\r
2244 values (for example, entering a password as "validpassword;database=somedb" in
\r
2245 an attempt to attach to a different database).</para>
\r
2246 </remarks><example>
\r
2247 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> and sets some of its properties
\r
2248 <code lang="Visual Basic">
\r
2249 Public Sub CreateConnection()
\r
2250 Dim myConnection As New MySqlConnection()
\r
2251 myConnection.ConnectionString = "Persist Security Info=False;database=myDB;server=myHost;Connect Timeout=30;user id=myUser; pwd=myPass"
\r
2252 myConnection.Open()
\r
2253 End Sub 'CreateConnection
\r
2256 public void CreateConnection()
\r
2258 MySqlConnection myConnection = new MySqlConnection();
\r
2259 myConnection.ConnectionString = "Persist Security Info=False;database=myDB;server=myHost;Connect Timeout=30;user id=myUser; pwd=myPass";
\r
2260 myConnection.Open();
\r
2263 </example><example>
\r
2264 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> in Unix environment with Mono installed. MySQL socket filename used in this example is "/var/lib/mysql/mysql.sock". The actual filename depends on your MySQL configuration.
\r
2265 <code lang="Visual Basic">
\r
2266 Public Sub CreateConnection()
\r
2267 Dim myConnection As New MySqlConnection()
\r
2268 myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass"
\r
2269 myConnection.Open()
\r
2270 End Sub 'CreateConnection
\r
2273 public void CreateConnection()
\r
2275 MySqlConnection myConnection = new MySqlConnection();
\r
2276 myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass";
\r
2277 myConnection.Open();
\r
2282 <member name="T:MySql.Data.MySqlClient.MySqlInfoMessageEventHandler">
\r
2284 Represents the method that will handle the <see cref="E:MySql.Data.MySqlClient.MySqlConnection.InfoMessage"/> event of a
\r
2285 <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>.
\r
2288 <member name="T:MySql.Data.MySqlClient.MySqlInfoMessageEventArgs">
\r
2290 Provides data for the InfoMessage event. This class cannot be inherited.
2293 <member name="F:MySql.Data.MySqlClient.MySqlInfoMessageEventArgs.errors">
\r
2298 <member name="T:MySql.Data.MySqlClient.MySqlConnectionString">
\r
2300 Summary description for MySqlConnectionString.
2303 <member name="M:MySql.Data.MySqlClient.MySqlConnectionString.GetConnectionString(System.Boolean)">
\r
2305 Takes a given connection string and returns it, possible
2306 stripping out the password info
2310 <member name="M:MySql.Data.MySqlClient.MySqlConnectionString.CreateConnectionString">
\r
2312 Uses the values in the keyValues hash to create a
2317 <member name="T:MySql.Data.MySqlClient.Crypt">
\r
2319 Summary description for Crypt.
\r
2322 <member name="M:MySql.Data.MySqlClient.Crypt.XorScramble(System.Byte[],System.Int32,System.Byte[],System.Int32,System.Byte[],System.Int32)">
\r
2324 Simple XOR scramble
\r
2326 <param name="from">Source array</param>
\r
2327 <param name="fromIndex">Index inside source array</param>
\r
2328 <param name="to">Destination array</param>
\r
2329 <param name="toIndex">Index inside destination array</param>
\r
2330 <param name="password">Password used to xor the bits</param>
\r
2331 <param name="length">Number of bytes to scramble</param>
\r
2333 <member name="M:MySql.Data.MySqlClient.Crypt.Get410Password(System.String,System.Byte[])">
\r
2335 Generate a scrambled password for 4.1.0 using new passwords
\r
2337 <param name="password">The password to scramble</param>
\r
2338 <param name="seedBytes">The seedbytes used to scramble</param>
\r
2339 <returns>Array of bytes containing the scrambled password</returns>
\r
2341 <member name="M:MySql.Data.MySqlClient.Crypt.GetOld410Password(System.String,System.Byte[])">
\r
2343 Generates a proper hash for old style 4.1.0 passwords. This would be used
\r
2344 if a 4.1.0 server contained old 16 byte hashes.
\r
2346 <param name="password">The password to hash</param>
\r
2347 <param name="seedBytes">Seed bytes received from the server</param>
\r
2348 <returns>Byte array containing the password hash</returns>
\r
2350 <member name="M:MySql.Data.MySqlClient.Crypt.Get411Password(System.String,System.String)">
\r
2352 Returns a byte array containing the proper encryption of the
\r
2353 given password/seed according to the new 4.1.1 authentication scheme.
\r
2355 <param name="password"></param>
\r
2356 <param name="seed"></param>
\r
2357 <returns></returns>
\r
2359 <member name="M:MySql.Data.MySqlClient.Crypt.EncryptPassword(System.String,System.String,System.Boolean)">
\r
2361 Encrypts a password using the MySql encryption scheme
\r
2363 <param name="password">The password to encrypt</param>
\r
2364 <param name="seed">The encryption seed the server gave us</param>
\r
2365 <param name="new_ver">Indicates if we should use the old or new encryption scheme</param>
\r
2366 <returns></returns>
\r
2368 <member name="M:MySql.Data.MySqlClient.Crypt.Hash(System.String)">
\r
2370 Hashes a password using the algorithm from Monty's code.
\r
2371 The first element in the return is the result of the "old" hash.
\r
2372 The second element is the rest of the "new" hash.
\r
2374 <param name="P">Password to be hashed</param>
\r
2375 <returns>Two element array containing the hashed values</returns>
\r
2377 <member name="T:MySql.Data.MySqlClient.MySqlDataAdapter">
\r
2379 Represents a set of data commands and a database connection that are used to fill a dataset and update a MySQL database. This class cannot be inherited.
\r
2380 </summary><remarks>
\r
2382 The <B>MySQLDataAdapter</B>, serves as a bridge between a <see cref="T:System.Data.DataSet"/>
\r
2383 and MySQL for retrieving and saving data. The <B>MySQLDataAdapter</B> provides this
\r
2384 bridge by mapping <see cref="M:System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable)"/>, which changes the data in the
\r
2385 <B>DataSet</B> to match the data in the data source, and <see cref="M:System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/>,
\r
2386 which changes the data in the data source to match the data in the <B>DataSet</B>,
\r
2387 using the appropriate SQL statements against the data source.
\r
2390 When the <B>MySQLDataAdapter</B> fills a <B>DataSet</B>, it will create the necessary
\r
2391 tables and columns for the returned data if they do not already exist. However, primary
\r
2392 key information will not be included in the implicitly created schema unless the
\r
2393 <see cref="T:System.Data.MissingSchemaAction"/> property is set to <see cref="F:System.Data.MissingSchemaAction.AddWithKey"/>.
\r
2394 You may also have the <B>MySQLDataAdapter</B> create the schema of the <B>DataSet</B>,
\r
2395 including primary key information, before filling it with data using <see cref="M:System.Data.Common.DbDataAdapter.FillSchema(System.Data.DataTable,System.Data.SchemaType)"/>.
\r
2397 <para><B>MySQLDataAdapter</B> is used in conjunction with <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>
\r
2398 and <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> to increase performance when connecting to a MySQL database.
\r
2400 <para>The <B>MySQLDataAdapter</B> also includes the <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/>,
\r
2401 <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.InsertCommand"/>, <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.DeleteCommand"/>,
\r
2402 <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.UpdateCommand"/>, and <see cref="P:System.Data.Common.DataAdapter.TableMappings"/>
\r
2403 properties to facilitate the loading and updating of data.
\r
2405 <para>When an instance of <B>MySQLDataAdapter</B> is created, the read/write properties
\r
2406 are set to initial values. For a list of these values, see the <B>MySQLDataAdapter</B>
\r
2410 Please be aware that the <see cref="T:System.Data.DataColumn"/> class in .NET 1.0 and 1.1 does not allow columns
\r
2411 with type of UInt16, UInt32, or UInt64 to be autoincrement columns. If you plan to use autoincremement
\r
2412 columns with MySQL, you should consider using signed integer columns.
\r
2414 </remarks><example>
\r
2415 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> and a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>.
\r
2416 The <B>MySqlConnection</B> is opened and set as the <see cref="P:MySql.Data.MySqlClient.MySqlCommand.Connection"/> for the
\r
2417 <B>MySqlCommand</B>. The example then calls <see cref="M:MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery"/>, and closes
\r
2418 the connection. To accomplish this, the <B>ExecuteNonQuery</B> is
\r
2419 passed a connection string and a query string that is a SQL INSERT
\r
2421 <code lang="Visual Basic">
\r
2422 Public Function SelectRows(dataSet As DataSet, connection As String, query As String) As DataSet
\r
2423 Dim conn As New MySqlConnection(connection)
\r
2424 Dim adapter As New MySqlDataAdapter()
\r
2425 adapter.SelectCommand = new MySqlCommand(query, conn)
\r
2426 adapter.Fill(dataset)
\r
2431 public DataSet SelectRows(DataSet dataset,string connection,string query)
\r
2433 MySqlConnection conn = new MySqlConnection(connection);
\r
2434 MySqlDataAdapter adapter = new MySqlDataAdapter();
\r
2435 adapter.SelectCommand = new MySqlCommand(query, conn);
\r
2436 adapter.Fill(dataset);
\r
2442 <member name="M:MySql.Data.MySqlClient.MySqlDataAdapter.#ctor">
\r
2443 <overloads></overloads><summary>
\r
2444 Initializes a new instance of the MySqlDataAdapter class.
\r
2445 </summary><remarks>
\r
2447 When an instance of <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> is created,
\r
2448 the following read/write properties are set to the following initial
\r
2451 <list type="table">
\r
2452 <listheader><term>Properties</term><term>Initial Value</term></listheader>
\r
2453 <item><term><see cref="T:System.Data.MissingMappingAction"/></term><term><B>MissingMappingAction.Passthrough</B></term></item>
\r
2454 <item><term><see cref="T:System.Data.MissingSchemaAction"/></term><term><B>MissingSchemaAction.Add</B></term></item>
\r
2457 You can change the value of any of these properties through a separate call
\r
2460 </remarks><example>
\r
2461 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> and sets some of
\r
2463 <code lang="Visual Basic">
\r
2464 Public Sub CreateSqlDataAdapter()
\r
2465 Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _
\r
2467 Dim da As MySqlDataAdapter = New MySqlDataAdapter
\r
2468 da.MissingSchemaAction = MissingSchemaAction.AddWithKey
\r
2470 da.SelectCommand = New MySqlCommand("SELECT id, name FROM mytable", conn)
\r
2471 da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
\r
2472 "VALUES (?id, ?name)", conn)
\r
2473 da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=?id, name=?name " & _
\r
2474 "WHERE id=?oldId", conn)
\r
2475 da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
\r
2477 da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
\r
2478 da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
\r
2480 da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
\r
2481 da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
\r
2482 da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
\r
2484 da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
\r
2488 public static void CreateSqlDataAdapter()
\r
2490 MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test");
\r
2491 MySqlDataAdapter da = new MySqlDataAdapter();
\r
2492 da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
\r
2494 da.SelectCommand = new MySqlCommand("SELECT id, name FROM mytable", conn);
\r
2495 da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
\r
2496 "VALUES (?id, ?name)", conn);
\r
2497 da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=?id, name=?name " +
\r
2498 "WHERE id=?oldId", conn);
\r
2499 da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
\r
2501 da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
\r
2502 da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
\r
2504 da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
\r
2505 da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
\r
2506 da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
\r
2508 da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
\r
2513 <member name="M:MySql.Data.MySqlClient.MySqlDataAdapter.#ctor(MySql.Data.MySqlClient.MySqlCommand)">
\r
2515 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> class with
\r
2516 the specified <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> as the <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/>
\r
2518 </summary><param name="selectCommand">
\r
2519 <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> that is a SQL SELECT statement or stored procedure and is set
\r
2520 as the <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/> property of the <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/>.
\r
2523 When an instance of <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> is created,
\r
2524 the following read/write properties are set to the following initial
\r
2527 <list type="table">
\r
2528 <listheader><term>Properties</term><term>Initial Value</term></listheader>
\r
2529 <item><term><see cref="T:System.Data.MissingMappingAction"/></term><term><B>MissingMappingAction.Passthrough</B></term></item>
\r
2530 <item><term><see cref="T:System.Data.MissingSchemaAction"/></term><term><B>MissingSchemaAction.Add</B></term></item>
\r
2533 You can change the value of any of these properties through a separate call
\r
2537 When <B>SelectCommand</B> (or any of the other command properties) is assigned
\r
2538 to a previously created <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/>, the <B>MySqlCommand</B> is not cloned.
\r
2539 The <B>SelectCommand</B> maintains a reference to the previously created <B>MySqlCommand</B>
\r
2542 </remarks><example>
\r
2543 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> and sets some of
\r
2545 <code lang="Visual Basic">
\r
2546 Public Sub CreateSqlDataAdapter()
\r
2547 Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _
\r
2549 Dim cmd as new MySqlCommand("SELECT id, name FROM mytable", conn)
\r
2550 Dim da As MySqlDataAdapter = New MySqlDataAdapter(cmd)
\r
2551 da.MissingSchemaAction = MissingSchemaAction.AddWithKey
\r
2553 da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
\r
2554 "VALUES (?id, ?name)", conn)
\r
2555 da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=?id, name=?name " & _
\r
2556 "WHERE id=?oldId", conn)
\r
2557 da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
\r
2559 da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
\r
2560 da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
\r
2562 da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
\r
2563 da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
\r
2564 da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
\r
2566 da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
\r
2570 public static void CreateSqlDataAdapter()
\r
2572 MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test");
\r
2573 MySqlCommand cmd = new MySqlCommand("SELECT id, name FROM mytable", conn);
\r
2574 MySqlDataAdapter da = new MySqlDataAdapter(cmd);
\r
2575 da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
\r
2577 da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
\r
2578 "VALUES (?id, ?name)", conn);
\r
2579 da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=?id, name=?name " +
\r
2580 "WHERE id=?oldId", conn);
\r
2581 da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
\r
2583 da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
\r
2584 da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
\r
2586 da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
\r
2587 da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
\r
2588 da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
\r
2590 da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
\r
2595 <member name="M:MySql.Data.MySqlClient.MySqlDataAdapter.#ctor(System.String,MySql.Data.MySqlClient.MySqlConnection)">
\r
2597 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> class with
\r
2598 a <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/> and a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object.
\r
2599 </summary><param name="selectCommandText">
\r
2600 A <b>String</b> that is a SQL SELECT statement or stored procedure to be used by
\r
2601 the <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/> property of the <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/>.
\r
2602 </param><param name="connection">A <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> that represents the connection.</param><remarks>
\r
2604 This implementation of the <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> opens and closes a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>
\r
2605 if it is not already open. This can be useful in a an application that must call the
\r
2606 <see cref="M:System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable)"/> method for two or more <B>MySqlDataAdapter</B> objects.
\r
2607 If the <B>MySqlConnection</B> is already open, you must explicitly call
\r
2608 <see cref="M:MySql.Data.MySqlClient.MySqlConnection.Close"/> or <see cref="M:MySql.Data.MySqlClient.MySqlConnection.Dispose(System.Boolean)"/> to close it.
\r
2611 When an instance of <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> is created,
\r
2612 the following read/write properties are set to the following initial
\r
2615 <list type="table">
\r
2616 <listheader><term>Properties</term><term>Initial Value</term></listheader>
\r
2617 <item><term><see cref="T:System.Data.MissingMappingAction"/></term><term><B>MissingMappingAction.Passthrough</B></term></item>
\r
2618 <item><term><see cref="T:System.Data.MissingSchemaAction"/></term><term><B>MissingSchemaAction.Add</B></term></item>
\r
2621 You can change the value of any of these properties through a separate call
\r
2624 </remarks><example>
\r
2625 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> and sets some of
\r
2627 <code lang="Visual Basic">
\r
2628 Public Sub CreateSqlDataAdapter()
\r
2629 Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _
\r
2631 Dim da As MySqlDataAdapter = New MySqlDataAdapter("SELECT id, name FROM mytable", conn)
\r
2632 da.MissingSchemaAction = MissingSchemaAction.AddWithKey
\r
2634 da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
\r
2635 "VALUES (?id, ?name)", conn)
\r
2636 da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=?id, name=?name " & _
\r
2637 "WHERE id=?oldId", conn)
\r
2638 da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
\r
2640 da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
\r
2641 da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
\r
2643 da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
\r
2644 da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
\r
2645 da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
\r
2647 da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
\r
2651 public static void CreateSqlDataAdapter()
\r
2653 MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test");
\r
2654 MySqlDataAdapter da = new MySqlDataAdapter("SELECT id, name FROM mytable", conn);
\r
2655 da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
\r
2657 da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
\r
2658 "VALUES (?id, ?name)", conn);
\r
2659 da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=?id, name=?name " +
\r
2660 "WHERE id=?oldId", conn);
\r
2661 da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
\r
2663 da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
\r
2664 da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
\r
2666 da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
\r
2667 da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
\r
2668 da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
\r
2670 da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
\r
2675 <member name="M:MySql.Data.MySqlClient.MySqlDataAdapter.#ctor(System.String,System.String)">
\r
2677 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> class with
\r
2678 a <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/> and a connection string.
\r
2679 </summary><param name="selectCommandText">
\r
2680 A <see cref="T:System.String"/> that is a SQL SELECT statement or stored procedure to
\r
2681 be used by the <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/> property of the <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/>.
\r
2682 </param><param name="selectConnString">The connection string</param><remarks>
\r
2684 When an instance of <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> is created,
\r
2685 the following read/write properties are set to the following initial
\r
2688 <list type="table">
\r
2689 <listheader><term>Properties</term><term>Initial Value</term></listheader>
\r
2690 <item><term><see cref="T:System.Data.MissingMappingAction"/></term><term><B>MissingMappingAction.Passthrough</B></term></item>
\r
2691 <item><term><see cref="T:System.Data.MissingSchemaAction"/></term><term><B>MissingSchemaAction.Add</B></term></item>
\r
2694 You can change the value of any of these properties through a separate call
\r
2697 </remarks><example>
\r
2698 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> and sets some of
\r
2700 <code lang="Visual Basic">
\r
2701 Public Sub CreateSqlDataAdapter()
\r
2702 Dim da As MySqlDataAdapter = New MySqlDataAdapter("SELECT id, name FROM mytable", "Data Source=localhost;database=test")
\r
2703 Dim conn As MySqlConnection = da.SelectCommand.Connection
\r
2704 da.MissingSchemaAction = MissingSchemaAction.AddWithKey
\r
2706 da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
\r
2707 "VALUES (?id, ?name)", conn)
\r
2708 da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=?id, name=?name " & _
\r
2709 "WHERE id=?oldId", conn)
\r
2710 da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
\r
2712 da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
\r
2713 da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
\r
2715 da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
\r
2716 da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
\r
2717 da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
\r
2719 da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
\r
2723 public static void CreateSqlDataAdapter()
\r
2725 MySqlDataAdapter da = new MySqlDataAdapter("SELECT id, name FROM mytable", "Data Source=localhost;database=test");
\r
2726 MySqlConnection conn = da.SelectCommand.Connection;
\r
2727 da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
\r
2729 da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
\r
2730 "VALUES (?id, ?name)", conn);
\r
2731 da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=?id, name=?name " +
\r
2732 "WHERE id=?oldId", conn);
\r
2733 da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
\r
2735 da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
\r
2736 da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
\r
2738 da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
\r
2739 da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
\r
2740 da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
\r
2742 da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
\r
2747 <member name="M:MySql.Data.MySqlClient.MySqlDataAdapter.CreateRowUpdatedEvent(System.Data.DataRow,System.Data.IDbCommand,System.Data.StatementType,System.Data.Common.DataTableMapping)">
\r
2749 Overridden. See <see cref="M:System.Data.Common.DbDataAdapter.CreateRowUpdatedEvent(System.Data.DataRow,System.Data.IDbCommand,System.Data.StatementType,System.Data.Common.DataTableMapping)"/>.
\r
2751 <param name="dataRow"></param>
\r
2752 <param name="command"></param>
\r
2753 <param name="statementType"></param>
\r
2754 <param name="tableMapping"></param>
\r
2755 <returns></returns>
\r
2757 <member name="M:MySql.Data.MySqlClient.MySqlDataAdapter.CreateRowUpdatingEvent(System.Data.DataRow,System.Data.IDbCommand,System.Data.StatementType,System.Data.Common.DataTableMapping)">
\r
2759 Overridden. See <see cref="M:System.Data.Common.DbDataAdapter.CreateRowUpdatingEvent(System.Data.DataRow,System.Data.IDbCommand,System.Data.StatementType,System.Data.Common.DataTableMapping)"/>.
\r
2761 <param name="dataRow"></param>
\r
2762 <param name="command"></param>
\r
2763 <param name="statementType"></param>
\r
2764 <param name="tableMapping"></param>
\r
2765 <returns></returns>
\r
2767 <member name="M:MySql.Data.MySqlClient.MySqlDataAdapter.OnRowUpdating(System.Data.Common.RowUpdatingEventArgs)">
\r
2769 Overridden. Raises the RowUpdating event.
2771 <param name="value">A MySqlRowUpdatingEventArgs that contains the event data.</param>
2773 <member name="M:MySql.Data.MySqlClient.MySqlDataAdapter.OnRowUpdated(System.Data.Common.RowUpdatedEventArgs)">
\r
2775 Overridden. Raises the RowUpdated event.
2777 <param name="value">A MySqlRowUpdatedEventArgs that contains the event data. </param>
2779 <member name="P:MySql.Data.MySqlClient.MySqlDataAdapter.DeleteCommand">
\r
2781 Gets or sets a SQL statement or stored procedure used to delete records from the data set.
\r
2783 A <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> used during <see cref="M:System.Data.Common.DataAdapter.Update(System.Data.DataSet)"/> to delete records in the
\r
2784 database that correspond to deleted rows in the <see cref="T:System.Data.DataSet"/>.
\r
2786 <para>During <see cref="M:System.Data.Common.DataAdapter.Update(System.Data.DataSet)"/>, if this property is not set and primary key information
\r
2787 is present in the <see cref="T:System.Data.DataSet"/>, the <B>DeleteCommand</B> can be generated
\r
2788 automatically if you set the <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/> property and use the
\r
2789 <see cref="T:MySql.Data.MySqlClient.MySqlCommandBuilder"/>. Then, any additional commands that you do not set are
\r
2790 generated by the <B>MySqlCommandBuilder</B>. This generation logic requires key column
\r
2791 information to be present in the <B>DataSet</B>.
\r
2794 When <B>DeleteCommand</B> is assigned to a previously created <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/>,
\r
2795 the <B>MySqlCommand</B> is not cloned. The <B>DeleteCommand</B> maintains a reference
\r
2796 to the previously created <B>MySqlCommand</B> object.
\r
2798 </remarks><example>
\r
2799 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> and sets the
\r
2800 <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/> and <B>DeleteCommand</B> properties. It assumes you have already
\r
2801 created a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object.
\r
2802 <code lang="Visual Basic">
\r
2803 Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
\r
2805 Dim da As MySqlDataAdapter = New MySqlDataAdapter()
\r
2806 Dim cmd As MySqlCommand
\r
2807 Dim parm As MySqlParameter
\r
2809 ' Create the SelectCommand.
\r
2810 cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn)
\r
2812 cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15)
\r
2813 cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15)
\r
2815 da.SelectCommand = cmd
\r
2817 ' Create the DeleteCommand.
\r
2818 cmd = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
\r
2820 parm = cmd.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
\r
2821 parm.SourceVersion = DataRowVersion.Original
\r
2823 da.DeleteCommand = cmd
\r
2829 public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
\r
2831 MySqlDataAdapter da = new MySqlDataAdapter();
\r
2833 MySqlParameter parm;
\r
2835 // Create the SelectCommand.
\r
2836 cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn);
\r
2838 cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15);
\r
2839 cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15);
\r
2841 da.SelectCommand = cmd;
\r
2843 // Create the DeleteCommand.
\r
2844 cmd = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
\r
2846 parm = cmd.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
\r
2847 parm.SourceVersion = DataRowVersion.Original;
\r
2849 da.DeleteCommand = cmd;
\r
2856 <member name="P:MySql.Data.MySqlClient.MySqlDataAdapter.InsertCommand">
\r
2858 Gets or sets a SQL statement or stored procedure used to insert records into the data set.
\r
2860 A <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> used during <see cref="M:System.Data.Common.DataAdapter.Update(System.Data.DataSet)"/> to insert records into the
\r
2861 database that correspond to new rows in the <see cref="T:System.Data.DataSet"/>.
\r
2863 <para>During <see cref="M:System.Data.Common.DataAdapter.Update(System.Data.DataSet)"/>, if this property is not set and primary key information
\r
2864 is present in the <see cref="T:System.Data.DataSet"/>, the <B>InsertCommand</B> can be generated
\r
2865 automatically if you set the <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/> property and use the
\r
2866 <see cref="T:MySql.Data.MySqlClient.MySqlCommandBuilder"/>. Then, any additional commands that you do not set are
\r
2867 generated by the <B>MySqlCommandBuilder</B>. This generation logic requires key column
\r
2868 information to be present in the <B>DataSet</B>.
\r
2871 When <B>InsertCommand</B> is assigned to a previously created <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/>,
\r
2872 the <B>MySqlCommand</B> is not cloned. The <B>InsertCommand</B> maintains a reference
\r
2873 to the previously created <B>MySqlCommand</B> object.
\r
2876 If execution of this command returns rows, these rows may be added to the <B>DataSet</B>
\r
2877 depending on how you set the <see cref="P:MySql.Data.MySqlClient.MySqlCommand.UpdatedRowSource"/> property of the <B>MySqlCommand</B> object.
\r
2879 </remarks><example>
\r
2880 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> and sets the
\r
2881 <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/> and <B>InsertCommand</B> properties. It assumes you have already
\r
2882 created a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object.
\r
2883 <code lang="Visual Basic">
\r
2884 Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
\r
2886 Dim da As MySqlDataAdapter = New MySqlDataAdapter()
\r
2887 Dim cmd As MySqlCommand
\r
2888 Dim parm As MySqlParameter
\r
2890 ' Create the SelectCommand.
\r
2891 cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn)
\r
2893 cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15)
\r
2894 cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15)
\r
2896 da.SelectCommand = cmd
\r
2898 ' Create the InsertCommand.
\r
2899 cmd = New MySqlCommand("INSERT INTO mytable (id,name) VALUES (?id, ?name)", conn)
\r
2901 cmd.Parameters.Add( "?id", MySqlDbType.VarChar, 15, "id" )
\r
2902 cmd.Parameters.Add( "?name", MySqlDbType.VarChar, 15, "name" )
\r
2903 da.InsertCommand = cmd
\r
2909 public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
\r
2911 MySqlDataAdapter da = new MySqlDataAdapter();
\r
2913 MySqlParameter parm;
\r
2915 // Create the SelectCommand.
\r
2916 cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn);
\r
2918 cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15);
\r
2919 cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15);
\r
2921 da.SelectCommand = cmd;
\r
2923 // Create the InsertCommand.
\r
2924 cmd = new MySqlCommand("INSERT INTO mytable (id,name) VALUES (?id,?name)", conn);
\r
2925 cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15, "id" );
\r
2926 cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15, "name" );
\r
2928 da.InsertCommand = cmd;
\r
2935 <member name="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand">
\r
2937 Gets or sets a SQL statement or stored procedure used to select records in the data source.
\r
2939 A <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> used during <see cref="M:System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable)"/> to select records from the
\r
2940 database for placement in the <see cref="T:System.Data.DataSet"/>.
\r
2942 <para>When <B>SelectCommand</B> is assigned to a previously created <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/>,
\r
2943 the <B>MySqlCommand</B> is not cloned. The <B>SelectCommand</B> maintains a reference to the
\r
2944 previously created <B>MySqlCommand</B> object.
\r
2947 If the <B>SelectCommand</B> does not return any rows, no tables are added to the
\r
2948 <see cref="T:System.Data.DataSet"/>, and no exception is raised.
\r
2950 </remarks><example>
\r
2951 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> and sets the
\r
2952 <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/> and <B>InsertCommand</B> properties. It assumes you have already
\r
2953 created a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object.
\r
2954 <code lang="Visual Basic">
\r
2955 Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
\r
2957 Dim da As MySqlDataAdapter = New MySqlDataAdapter()
\r
2958 Dim cmd As MySqlCommand
\r
2959 Dim parm As MySqlParameter
\r
2961 ' Create the SelectCommand.
\r
2962 cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn)
\r
2964 cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15)
\r
2965 cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15)
\r
2967 da.SelectCommand = cmd
\r
2969 ' Create the InsertCommand.
\r
2970 cmd = New MySqlCommand("INSERT INTO mytable (id,name) VALUES (?id, ?name)", conn)
\r
2972 cmd.Parameters.Add( "?id", MySqlDbType.VarChar, 15, "id" )
\r
2973 cmd.Parameters.Add( "?name", MySqlDbType.VarChar, 15, "name" )
\r
2974 da.InsertCommand = cmd
\r
2980 public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
\r
2982 MySqlDataAdapter da = new MySqlDataAdapter();
\r
2984 MySqlParameter parm;
\r
2986 // Create the SelectCommand.
\r
2987 cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn);
\r
2989 cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15);
\r
2990 cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15);
\r
2992 da.SelectCommand = cmd;
\r
2994 // Create the InsertCommand.
\r
2995 cmd = new MySqlCommand("INSERT INTO mytable (id,name) VALUES (?id,?name)", conn);
\r
2996 cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15, "id" );
\r
2997 cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15, "name" );
\r
2999 da.InsertCommand = cmd;
\r
3006 <member name="P:MySql.Data.MySqlClient.MySqlDataAdapter.UpdateCommand">
\r
3008 Gets or sets a SQL statement or stored procedure used to updated records in the data source.
\r
3010 A <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> used during <see cref="M:System.Data.Common.DataAdapter.Update(System.Data.DataSet)"/> to update records in the
\r
3011 database with data from the <see cref="T:System.Data.DataSet"/>.
\r
3013 <para>During <see cref="M:System.Data.Common.DataAdapter.Update(System.Data.DataSet)"/>, if this property is not set and primary key information
\r
3014 is present in the <see cref="T:System.Data.DataSet"/>, the <B>UpdateCommand</B> can be generated
\r
3015 automatically if you set the <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/> property and use the
\r
3016 <see cref="T:MySql.Data.MySqlClient.MySqlCommandBuilder"/>. Then, any additional commands that you do not set are
\r
3017 generated by the <B>MySqlCommandBuilder</B>. This generation logic requires key column
\r
3018 information to be present in the <B>DataSet</B>.
\r
3021 When <B>UpdateCommand</B> is assigned to a previously created <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/>,
\r
3022 the <B>MySqlCommand</B> is not cloned. The <B>UpdateCommand</B> maintains a reference
\r
3023 to the previously created <B>MySqlCommand</B> object.
\r
3026 If execution of this command returns rows, these rows may be merged with the DataSet
\r
3027 depending on how you set the <see cref="P:MySql.Data.MySqlClient.MySqlCommand.UpdatedRowSource"/> property of the <B>MySqlCommand</B> object.
\r
3029 </remarks><example>
\r
3030 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/> and sets the
\r
3031 <see cref="P:MySql.Data.MySqlClient.MySqlDataAdapter.SelectCommand"/> and <B>UpdateCommand</B> properties. It assumes you have already
\r
3032 created a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object.
\r
3033 <code lang="Visual Basic">
\r
3034 Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
\r
3036 Dim da As MySqlDataAdapter = New MySqlDataAdapter()
\r
3037 Dim cmd As MySqlCommand
\r
3038 Dim parm As MySqlParameter
\r
3040 ' Create the SelectCommand.
\r
3041 cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn)
\r
3043 cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15)
\r
3044 cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15)
\r
3046 da.SelectCommand = cmd
\r
3048 ' Create the UpdateCommand.
\r
3049 cmd = New MySqlCommand("UPDATE mytable SET id=?id, name=?name WHERE id=?oldId", conn)
\r
3051 cmd.Parameters.Add( "?id", MySqlDbType.VarChar, 15, "id" )
\r
3052 cmd.Parameters.Add( "?name", MySqlDbType.VarChar, 15, "name" )
\r
3054 parm = cmd.Parameters.Add("?oldId", MySqlDbType.VarChar, 15, "id")
\r
3055 parm.SourceVersion = DataRowVersion.Original
\r
3057 da.UpdateCommand = cmd
\r
3063 public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
\r
3065 MySqlDataAdapter da = new MySqlDataAdapter();
\r
3067 MySqlParameter parm;
\r
3069 // Create the SelectCommand.
\r
3070 cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn);
\r
3072 cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15);
\r
3073 cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15);
\r
3075 da.SelectCommand = cmd;
\r
3077 // Create the UpdateCommand.
\r
3078 cmd = new MySqlCommand("UPDATE mytable SET id=?id, name=?name WHERE id=?oldId", conn);
\r
3079 cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15, "id" );
\r
3080 cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15, "name" );
\r
3082 parm = cmd.Parameters.Add( "?oldId", MySqlDbType.VarChar, 15, "id" );
\r
3083 parm.SourceVersion = DataRowVersion.Original;
\r
3085 da.UpdateCommand = cmd;
\r
3092 <member name="E:MySql.Data.MySqlClient.MySqlDataAdapter.RowUpdating">
\r
3094 Occurs during Update before a command is executed against the data source. The attempt to update is made, so the event fires.
3097 <member name="E:MySql.Data.MySqlClient.MySqlDataAdapter.RowUpdated">
\r
3099 Occurs during Update after a command is executed against the data source. The attempt to update is made, so the event fires.
3102 <member name="T:MySql.Data.MySqlClient.MySqlRowUpdatingEventHandler">
\r
3104 Represents the method that will handle the <see cref="E:MySql.Data.MySqlClient.MySqlDataAdapter.RowUpdating"/> event of a <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/>.
\r
3107 <member name="T:MySql.Data.MySqlClient.MySqlRowUpdatedEventHandler">
\r
3109 Represents the method that will handle the <see cref="E:MySql.Data.MySqlClient.MySqlDataAdapter.RowUpdated"/> event of a <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/>.
\r
3112 <member name="T:MySql.Data.MySqlClient.MySqlRowUpdatingEventArgs">
\r
3114 Provides data for the RowUpdating event. This class cannot be inherited.
3117 <member name="M:MySql.Data.MySqlClient.MySqlRowUpdatingEventArgs.#ctor(System.Data.DataRow,System.Data.IDbCommand,System.Data.StatementType,System.Data.Common.DataTableMapping)">
\r
3119 Initializes a new instance of the MySqlRowUpdatingEventArgs class.
\r
3121 <param name="row">The <see cref="T:System.Data.DataRow"/> to <see cref="M:System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/>.</param>
\r
3122 <param name="command">The <see cref="T:System.Data.IDbCommand"/> to execute during <see cref="M:System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/>.</param>
\r
3123 <param name="statementType">One of the <see cref="T:System.Data.StatementType"/> values that specifies the type of query executed.</param>
\r
3124 <param name="tableMapping">The <see cref="T:System.Data.Common.DataTableMapping"/> sent through an <see cref="M:System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/>.</param>
\r
3126 <member name="P:MySql.Data.MySqlClient.MySqlRowUpdatingEventArgs.Command">
\r
3128 Gets or sets the MySqlCommand to execute when performing the Update.
3131 <member name="T:MySql.Data.MySqlClient.MySqlRowUpdatedEventArgs">
\r
3133 Provides data for the RowUpdated event. This class cannot be inherited.
3136 <member name="M:MySql.Data.MySqlClient.MySqlRowUpdatedEventArgs.#ctor(System.Data.DataRow,System.Data.IDbCommand,System.Data.StatementType,System.Data.Common.DataTableMapping)">
\r
3138 Initializes a new instance of the MySqlRowUpdatedEventArgs class.
\r
3140 <param name="row">The <see cref="T:System.Data.DataRow"/> sent through an <see cref="M:System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/>.</param>
\r
3141 <param name="command">The <see cref="T:System.Data.IDbCommand"/> executed when <see cref="M:System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/> is called.</param>
\r
3142 <param name="statementType">One of the <see cref="T:System.Data.StatementType"/> values that specifies the type of query executed.</param>
\r
3143 <param name="tableMapping">The <see cref="T:System.Data.Common.DataTableMapping"/> sent through an <see cref="M:System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/>.</param>
\r
3145 <member name="P:MySql.Data.MySqlClient.MySqlRowUpdatedEventArgs.Command">
\r
3147 Gets or sets the MySqlCommand executed when Update is called.
3150 <member name="T:MySql.Data.MySqlClient.MySqlDataReader">
\r
3152 Provides a means of reading a forward-only stream of rows from a MySQL database. This class cannot be inherited.
\r
3155 <para>To create a <B>MySQLDataReader</B>, you must call the <see cref="M:MySql.Data.MySqlClient.MySqlCommand.ExecuteReader"/>
\r
3156 method of the <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> object, rather than directly using a constructor.
\r
3158 <para>While the <B>MySqlDataReader</B> is in use, the associated <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>
\r
3159 is busy serving the <B>MySqlDataReader</B>, and no other operations can be performed
\r
3160 on the <B>MySqlConnection</B> other than closing it. This is the case until the
\r
3161 <see cref="M:MySql.Data.MySqlClient.MySqlDataReader.Close"/> method of the <B>MySqlDataReader</B> is called.
\r
3163 <para><see cref="P:MySql.Data.MySqlClient.MySqlDataReader.IsClosed"/> and <see cref="P:MySql.Data.MySqlClient.MySqlDataReader.RecordsAffected"/>
\r
3164 are the only properties that you can call after the <B>MySqlDataReader</B> is
\r
3165 closed. Though the <B>RecordsAffected</B> property may be accessed at any time
\r
3166 while the <B>MySqlDataReader</B> exists, always call <B>Close</B> before returning
\r
3167 the value of <B>RecordsAffected</B> to ensure an accurate return value.
\r
3169 <para>For optimal performance, <B>MySqlDataReader</B> avoids creating
\r
3170 unnecessary objects or making unnecessary copies of data. As a result, multiple calls
\r
3171 to methods such as <see cref="M:MySql.Data.MySqlClient.MySqlDataReader.GetValue(System.Int32)"/> return a reference to the
\r
3172 same object. Use caution if you are modifying the underlying value of the objects
\r
3173 returned by methods such as <B>GetValue</B>.
\r
3175 </remarks><example>
\r
3176 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/>,
\r
3177 a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/>, and a <B>MySqlDataReader</B>. The example reads through
\r
3178 the data, writing it out to the console. Finally, the example closes the <B>MySqlDataReader</B>, then the
\r
3179 <B>MySqlConnection</B>.
\r
3180 <code lang="Visual Basic">
\r
3181 Public Sub ReadMyData(myConnString As String)
\r
3182 Dim mySelectQuery As String = "SELECT OrderID, CustomerID FROM Orders"
\r
3183 Dim myConnection As New MySqlConnection(myConnString)
\r
3184 Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
\r
3185 myConnection.Open()
\r
3186 Dim myReader As MySqlDataReader
\r
3187 myReader = myCommand.ExecuteReader()
\r
3188 ' Always call Read before accessing data.
\r
3189 While myReader.Read()
\r
3190 Console.WriteLine((myReader.GetInt32(0) & ", " & myReader.GetString(1)))
\r
3192 ' always call Close when done reading.
\r
3194 ' Close the connection when done with it.
\r
3195 myConnection.Close()
\r
3196 End Sub 'ReadMyData
\r
3199 public void ReadMyData(string myConnString) {
\r
3200 string mySelectQuery = "SELECT OrderID, CustomerID FROM Orders";
\r
3201 MySqlConnection myConnection = new MySqlConnection(myConnString);
\r
3202 MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection);
\r
3203 myConnection.Open();
\r
3204 MySqlDataReader myReader;
\r
3205 myReader = myCommand.ExecuteReader();
\r
3206 // Always call Read before accessing data.
\r
3207 while (myReader.Read()) {
\r
3208 Console.WriteLine(myReader.GetInt32(0) + ", " + myReader.GetString(1));
\r
3210 // always call Close when done reading.
\r
3212 // Close the connection when done with it.
\r
3213 myConnection.Close();
\r
3218 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.Close">
\r
3220 Closes the MySqlDataReader object.
3223 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetBoolean(System.Int32)">
\r
3225 Gets the value of the specified column as a Boolean.
3227 <param name="i"></param>
3230 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetByte(System.Int32)">
\r
3232 Gets the value of the specified column as a byte.
3234 <param name="i"></param>
3237 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetBytes(System.Int32,System.Int64,System.Byte[],System.Int32,System.Int32)">
\r
3239 Reads a stream of bytes from the specified column offset into the buffer an array starting at the given buffer offset.
\r
3241 <param name="i">The zero-based column ordinal. </param>
\r
3242 <param name="dataIndex">The index within the field from which to begin the read operation. </param>
\r
3243 <param name="buffer">The buffer into which to read the stream of bytes. </param>
\r
3244 <param name="bufferIndex">The index for buffer to begin the read operation. </param>
\r
3245 <param name="length">The maximum length to copy into the buffer. </param>
\r
3246 <returns>The actual number of bytes read.</returns>
\r
3247 <!-- No matching elements were found for the following include tag --><include file="docs/MySqlDataReader.xml" path="MyDocs/MyMembers[@name="GetBytes"]/*"/>
\r
3249 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetChar(System.Int32)">
\r
3251 Gets the value of the specified column as a single character.
3253 <param name="i"></param>
3256 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetChars(System.Int32,System.Int64,System.Char[],System.Int32,System.Int32)">
\r
3258 Reads a stream of characters from the specified column offset into the buffer as an array starting at the given buffer offset.
3260 <param name="i"></param>
3261 <param name="fieldOffset"></param>
3262 <param name="buffer"></param>
3263 <param name="bufferoffset"></param>
3264 <param name="length"></param>
3267 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetDataTypeName(System.Int32)">
\r
3269 Gets the name of the source data type.
3271 <param name="i"></param>
3274 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetMySqlDateTime(System.Int32)">
\r
3275 <summary>Gets the value of the specified column as a <see cref="T:MySql.Data.Types.MySqlDateTime"/> object.</summary><remarks>
\r
3276 </remarks><param name="index">The zero-based column ordinal.</param><returns>The value of the specified column.</returns>
\r
3278 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetDateTime(System.Int32)">
\r
3279 <summary>Gets the value of the specified column as a <see cref="T:System.DateTime"/> object.</summary><remarks>
\r
3282 MySql allows date columns to contain the value '0000-00-00' and datetime
\r
3283 columns to contain the value '0000-00-00 00:00:00'. The DateTime structure cannot contain
\r
3284 or represent these values. To read a datetime value from a column that might
\r
3285 contain zero values, use <see cref="M:MySql.Data.MySqlClient.MySqlDataReader.GetMySqlDateTime(System.Int32)"/>.
\r
3288 The behavior of reading a zero datetime column using this method is defined by the
\r
3289 <i>ZeroDateTimeBehavior</i> connection string option. For more information on this option,
\r
3290 please refer to <see cref="P:MySql.Data.MySqlClient.MySqlConnection.ConnectionString"/>.
\r
3293 </remarks><param name="index">The zero-based column ordinal.</param><returns>The value of the specified column.</returns>
\r
3295 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetDecimal(System.Int32)">
\r
3296 <summary>Gets the value of the specified column as a <see cref="T:System.Decimal"/> object.</summary><remarks></remarks><param name="index">The zero-based column ordinal.</param><returns>The value of the specified column.</returns>
\r
3298 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetDouble(System.Int32)">
\r
3299 <summary>Gets the value of the specified column as a double-precision floating point number.</summary><remarks></remarks><param name="index">The zero-based column ordinal.</param><returns>The value of the specified column.</returns>
\r
3301 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetFieldType(System.Int32)">
\r
3303 Gets the Type that is the data type of the object.
3305 <param name="i"></param>
3308 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetFloat(System.Int32)">
\r
3309 <summary>Gets the value of the specified column as a single-precision floating point number.</summary><param name="index">The zero-based column ordinal.</param><returns>The value of the specified column.</returns>
\r
3311 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetGuid(System.Int32)">
\r
3312 <!-- No matching elements were found for the following include tag --><include file="docs/MySqlDataReader.xml" path="docs/GetGuid/*"/>
\r
3314 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetInt16(System.Int32)">
\r
3315 <summary>Gets the value of the specified column as a 16-bit signed integer.</summary><param name="index">The zero-based column ordinal.</param><returns>The value of the specified column.</returns>
\r
3317 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetInt32(System.Int32)">
\r
3318 <summary>Gets the value of the specified column as a 32-bit signed integer.</summary><param name="index">The zero-based column ordinal.</param><returns>The value of the specified column.</returns>
\r
3320 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetInt64(System.Int32)">
\r
3321 <summary>Gets the value of the specified column as a 64-bit signed integer.</summary><param name="index">The zero-based column ordinal.</param><returns>The value of the specified column.</returns>
\r
3323 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetName(System.Int32)">
\r
3325 Gets the name of the specified column.
3327 <param name="i"></param>
3330 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetOrdinal(System.String)">
\r
3332 Gets the column ordinal, given the name of the column.
3334 <param name="name"></param>
3337 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetSchemaTable">
\r
3339 Returns a DataTable that describes the column metadata of the MySqlDataReader.
3343 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetString(System.Int32)">
\r
3344 <summary>Gets the value of the specified column as a <see cref="T:System.String"/> object.</summary><remarks></remarks><param name="index">The zero-based column ordinal.</param><returns>The value of the specified column.</returns>
\r
3346 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetTimeSpan(System.Int32)">
\r
3347 <summary>Gets the value of the specified column as a <see cref="T:System.TimeSpan"/> object.</summary><remarks>
\r
3348 </remarks><param name="index">The zero-based column ordinal.</param><returns>The value of the specified column.</returns>
\r
3350 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetValue(System.Int32)">
\r
3352 Gets the value of the specified column in its native format.
3354 <param name="i"></param>
3357 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetValues(System.Object[])">
\r
3359 Gets all attribute columns in the collection for the current row.
3361 <param name="values"></param>
3364 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetUInt16(System.Int32)">
\r
3365 <summary>Gets the value of the specified column as a 16-bit unsigned integer.</summary><param name="index">The zero-based column ordinal.</param><returns>The value of the specified column.</returns>
\r
3367 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetUInt32(System.Int32)">
\r
3368 <summary>Gets the value of the specified column as a 32-bit unsigned integer.</summary><param name="index">The zero-based column ordinal.</param><returns>The value of the specified column.</returns>
\r
3370 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.GetUInt64(System.Int32)">
\r
3371 <summary>Gets the value of the specified column as a 64-bit unsigned integer.</summary><param name="index">The zero-based column ordinal.</param><returns>The value of the specified column.</returns>
\r
3373 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.IsDBNull(System.Int32)">
\r
3375 Gets a value indicating whether the column contains non-existent or missing values.
3377 <param name="i"></param>
3380 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.NextResult">
\r
3382 Advances the data reader to the next result, when reading the results of batch SQL statements.
3386 <member name="M:MySql.Data.MySqlClient.MySqlDataReader.Read">
\r
3388 Advances the MySqlDataReader to the next record.
3392 <member name="P:MySql.Data.MySqlClient.MySqlDataReader.Depth">
\r
3394 Gets a value indicating the depth of nesting for the current row. This method is not
3395 supported currently and always returns 0.
3398 <member name="P:MySql.Data.MySqlClient.MySqlDataReader.IsClosed">
\r
3400 Gets a value indicating whether the data reader is closed.
3403 <member name="P:MySql.Data.MySqlClient.MySqlDataReader.RecordsAffected">
\r
3405 Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.
3408 <member name="P:MySql.Data.MySqlClient.MySqlDataReader.HasRows">
\r
3410 Gets a value indicating whether the MySqlDataReader contains one or more rows.
3413 <member name="P:MySql.Data.MySqlClient.MySqlDataReader.FieldCount">
\r
3415 Gets the number of columns in the current row.
3418 <member name="P:MySql.Data.MySqlClient.MySqlDataReader.Item(System.Int32)">
\r
3420 Overloaded. Gets the value of a column in its native format.
3421 In C#, this property is the indexer for the MySqlDataReader class.
3424 <member name="P:MySql.Data.MySqlClient.MySqlDataReader.Item(System.String)">
\r
3426 Gets the value of a column in its native format.
3427 [C#] In C#, this property is the indexer for the MySqlDataReader class.
3430 <member name="T:MySql.Data.MySqlClient.Driver">
\r
3432 Summary description for BaseDriver.
\r
3435 <member name="M:MySql.Data.MySqlClient.Driver.Configure(MySql.Data.MySqlClient.MySqlConnection)">
\r
3437 I don't like this setup but can't think of a better way of doing
3440 <param name="connection"></param>
3442 <member name="M:MySql.Data.MySqlClient.Driver.LoadCharacterSets">
\r
3444 Loads all the current character set names and ids for this server
\r
3445 into the charSets hashtable
\r
3448 <member name="T:MySql.Data.MySqlClient.MySqlException">
\r
3450 The exception that is thrown when MySQL returns an error. This class cannot be inherited.
\r
3454 This class is created whenever the MySql Data Provider encounters an error generated from the server.
\r
3457 Any open connections are not automatically closed when an exception is thrown. If
\r
3458 the client application determines that the exception is fatal, it should close any open
\r
3459 <see cref="T:MySql.Data.MySqlClient.MySqlDataReader"/> objects or <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> objects.
\r
3461 </remarks><example>
\r
3462 The following example generates a <B>MySqlException</B> due to a missing server,
\r
3463 and then displays the exception.
\r
3465 <code lang="Visual Basic">
\r
3466 Public Sub ShowException()
\r
3467 Dim mySelectQuery As String = "SELECT column1 FROM table1"
\r
3468 Dim myConnection As New MySqlConnection ("Data Source=localhost;Database=Sample;")
\r
3469 Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
\r
3472 myCommand.Connection.Open()
\r
3473 Catch e As MySqlException
\r
3474 MessageBox.Show( e.Message )
\r
3479 public void ShowException()
\r
3481 string mySelectQuery = "SELECT column1 FROM table1";
\r
3482 MySqlConnection myConnection =
\r
3483 new MySqlConnection("Data Source=localhost;Database=Sample;");
\r
3484 MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection);
\r
3488 myCommand.Connection.Open();
\r
3490 catch (MySqlException e)
\r
3492 MessageBox.Show( e.Message );
\r
3498 <member name="P:MySql.Data.MySqlClient.MySqlException.Number">
\r
3500 Gets a number that identifies the type of error.
3503 <member name="P:MySql.Data.MySqlClient.MySqlException.IsFatal">
\r
3505 True if this exception was fatal and cause the closing of the connection, false otherwise.
\r
3508 <member name="T:MySql.Data.MySqlClient.MySqlField">
\r
3510 Summary description for Field.
3513 <member name="T:MySql.Data.MySqlClient.Logger">
\r
3515 Provides methods to output messages to our log
\r
3518 <member name="T:MySql.Data.MySqlClient.ClientFlags">
\r
3520 Summary description for ClientParam.
3523 <member name="T:MySql.Data.MySqlClient.DBCmd">
\r
3528 <member name="T:MySql.Data.MySqlClient.MySqlDbType">
\r
3530 Specifies MySQL specific data type of a field, property, for use in a <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/>.
\r
3533 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Decimal">
\r
3534 <summary> <see cref="F:MySql.Data.MySqlClient.MySqlDbType.Decimal"/><para>A fixed precision and scale numeric value between -1038 -1 and 10 38 -1.</para></summary>
\r
3536 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Byte">
\r
3537 <summary> <see cref="F:MySql.Data.MySqlClient.MySqlDbType.Byte"/><para>The signed range is -128 to 127. The unsigned range is 0 to 255.</para></summary>
\r
3539 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Int16">
\r
3540 <summary><see cref="F:MySql.Data.MySqlClient.MySqlDbType.Int16"/><para>A 16-bit signed integer. The signed range is -32768 to 32767. The unsigned range is 0 to 65535</para></summary>
\r
3542 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Int24">
\r
3543 <summary>Specifies a 24 (3 byte) signed or unsigned value.</summary>
3545 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Int32">
\r
3546 <summary><see cref="F:MySql.Data.MySqlClient.MySqlDbType.Int32"/><para>A 32-bit signed integer</para></summary>
\r
3548 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Int64">
\r
3549 <summary><see cref="F:MySql.Data.MySqlClient.MySqlDbType.Int64"/><para>A 64-bit signed integer.</para></summary>
\r
3551 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Float">
\r
3552 <summary><see cref="T:System.Single"/><para>A small (single-precision) floating-point number. Allowable values are -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38.</para></summary>
\r
3554 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Double">
\r
3555 <summary><see cref="F:MySql.Data.MySqlClient.MySqlDbType.Double"/><para>A normal-size (double-precision) floating-point number. Allowable values are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to 1.7976931348623157E+308.</para></summary>
\r
3557 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Timestamp">
\r
3558 <summary>A timestamp. The range is '1970-01-01 00:00:00' to sometime in the year 2037</summary>
3560 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Date">
\r
3561 <summary>Date The supported range is '1000-01-01' to '9999-12-31'.</summary>
3563 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Time">
\r
3564 <summary> Time <para>The range is '-838:59:59' to '838:59:59'.</para></summary>
3566 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Datetime">
\r
3567 <summary>DateTime The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.</summary>
3569 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Year">
\r
3570 <summary>A year in 2- or 4-digit format (default is 4-digit). The allowable values are 1901 to 2155, 0000 in the 4-digit year format, and 1970-2069 if you use the 2-digit format (70-69)</summary>
3572 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Newdate">
\r
3573 <summary><b>Obsolete</b> Use Datetime or Date type</summary>
3575 <member name="F:MySql.Data.MySqlClient.MySqlDbType.VarString">
\r
3576 <summary>A variable-length string containing 0 to 65535 characters</summary>
3578 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Bit">
\r
3579 <summary>Bit-field data type</summary>
3581 <member name="F:MySql.Data.MySqlClient.MySqlDbType.NewDecimal">
\r
3582 <summary>New Decimal</summary>
3584 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Enum">
\r
3585 <summary>An enumeration. A string object that can have only one value, chosen from the list of values 'value1', 'value2', ..., NULL or the special "" error value. An ENUM can have a maximum of 65535 distinct values</summary>
3587 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Set">
\r
3588 <summary>A set. A string object that can have zero or more values, each of which must be chosen from the list of values 'value1', 'value2', ... A SET can have a maximum of 64 members.</summary>
3590 <member name="F:MySql.Data.MySqlClient.MySqlDbType.TinyBlob">
\r
3591 <summary>A BLOB or TEXT column with a maximum length of 255 (2^8 - 1) characters</summary>
3593 <member name="F:MySql.Data.MySqlClient.MySqlDbType.MediumBlob">
\r
3594 <summary>A BLOB or TEXT column with a maximum length of 16777215 (2^24 - 1) characters</summary>
3596 <member name="F:MySql.Data.MySqlClient.MySqlDbType.LongBlob">
\r
3597 <summary>A BLOB or TEXT column with a maximum length of 4294967295 or 4G (2^32 - 1) characters</summary>
3599 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Blob">
\r
3600 <summary>A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1) characters</summary>
3602 <member name="F:MySql.Data.MySqlClient.MySqlDbType.VarChar">
\r
3603 <summary>A variable-length string containing 0 to 255 characters</summary>
3605 <member name="F:MySql.Data.MySqlClient.MySqlDbType.String">
\r
3606 <summary><b>Obsolete</b> Use VarChar type</summary>
3608 <member name="F:MySql.Data.MySqlClient.MySqlDbType.Geometry">
\r
3611 <member name="F:MySql.Data.MySqlClient.MySqlDbType.UByte">
\r
3612 <summary></summary>
\r
3614 <member name="F:MySql.Data.MySqlClient.MySqlDbType.UInt16">
\r
3615 <summary></summary>
\r
3617 <member name="F:MySql.Data.MySqlClient.MySqlDbType.UInt24">
\r
3618 <summary></summary>
\r
3620 <member name="F:MySql.Data.MySqlClient.MySqlDbType.UInt32">
\r
3621 <summary></summary>
\r
3623 <member name="F:MySql.Data.MySqlClient.MySqlDbType.UInt64">
\r
3624 <summary></summary>
\r
3626 <member name="T:MySql.Data.MySqlClient.MySqlError">
\r
3628 Collection of error codes that can be returned by the server
3631 <member name="M:MySql.Data.MySqlClient.MySqlError.#ctor(System.String,System.Int32,System.String)">
\r
3632 <summary></summary>
\r
3633 <param name="level"></param>
\r
3634 <param name="code"></param>
\r
3635 <param name="message"></param>
3637 <member name="P:MySql.Data.MySqlClient.MySqlError.Level">
\r
3642 <member name="P:MySql.Data.MySqlClient.MySqlError.Code">
\r
3647 <member name="P:MySql.Data.MySqlClient.MySqlError.Message">
\r
3652 <member name="T:MySql.Data.MySqlClient.MySqlHelper">
\r
3654 Helper class that makes it easier to work with the provider.
3657 <member name="M:MySql.Data.MySqlClient.MySqlHelper.ExecuteNonQuery(MySql.Data.MySqlClient.MySqlConnection,System.String,MySql.Data.MySqlClient.MySqlParameter[])">
\r
3659 Executes a single command against a MySQL database. The <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> is assumed to be
\r
3660 open when the method is called and remains open after the method completes.
\r
3662 <param name="connection"><see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object to use</param>
\r
3663 <param name="commandText">SQL command to be executed</param>
\r
3664 <param name="commandParameters">Array of <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> objects to use with the command.</param>
\r
3665 <returns></returns>
\r
3667 <member name="M:MySql.Data.MySqlClient.MySqlHelper.ExecuteNonQuery(System.String,System.String,MySql.Data.MySqlClient.MySqlParameter[])">
\r
3669 Executes a single command against a MySQL database. A new <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> is created
\r
3670 using the <see cref="P:MySql.Data.MySqlClient.MySqlConnection.ConnectionString"/> given.
\r
3672 <param name="connectionString"><see cref="P:MySql.Data.MySqlClient.MySqlConnection.ConnectionString"/> to use</param>
\r
3673 <param name="commandText">SQL command to be executed</param>
\r
3674 <param name="parms">Array of <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> objects to use with the command.</param>
\r
3675 <returns></returns>
\r
3677 <member name="M:MySql.Data.MySqlClient.MySqlHelper.ExecuteDataRow(System.String,System.String,MySql.Data.MySqlClient.MySqlParameter[])">
\r
3679 Executes a single SQL command and returns the first row of the resultset. A new MySqlConnection object
3680 is created, opened, and closed during this method.
3682 <param name="connectionString">Settings to be used for the connection</param>
3683 <param name="commandText">Command to execute</param>
3684 <param name="parms">Parameters to use for the command</param>
3685 <returns>DataRow containing the first row of the resultset</returns>
3687 <member name="M:MySql.Data.MySqlClient.MySqlHelper.ExecuteDataset(System.String,System.String)">
\r
3689 Executes a single SQL command and returns the resultset in a <see cref="T:System.Data.DataSet"/>.
\r
3690 A new MySqlConnection object is created, opened, and closed during this method.
\r
3692 <param name="connectionString">Settings to be used for the connection</param>
\r
3693 <param name="commandText">Command to execute</param>
\r
3694 <returns><see cref="T:System.Data.DataSet"/> containing the resultset</returns>
\r
3696 <member name="M:MySql.Data.MySqlClient.MySqlHelper.ExecuteDataset(System.String,System.String,MySql.Data.MySqlClient.MySqlParameter[])">
\r
3698 Executes a single SQL command and returns the resultset in a <see cref="T:System.Data.DataSet"/>.
\r
3699 A new MySqlConnection object is created, opened, and closed during this method.
\r
3701 <param name="connectionString">Settings to be used for the connection</param>
\r
3702 <param name="commandText">Command to execute</param>
\r
3703 <param name="commandParameters">Parameters to use for the command</param>
\r
3704 <returns><see cref="T:System.Data.DataSet"/> containing the resultset</returns>
\r
3706 <member name="M:MySql.Data.MySqlClient.MySqlHelper.ExecuteDataset(MySql.Data.MySqlClient.MySqlConnection,System.String)">
\r
3708 Executes a single SQL command and returns the resultset in a <see cref="T:System.Data.DataSet"/>.
\r
3709 The state of the <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object remains unchanged after execution
\r
3712 <param name="connection"><see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object to use</param>
\r
3713 <param name="commandText">Command to execute</param>
\r
3714 <returns><see cref="T:System.Data.DataSet"/> containing the resultset</returns>
\r
3716 <member name="M:MySql.Data.MySqlClient.MySqlHelper.ExecuteDataset(MySql.Data.MySqlClient.MySqlConnection,System.String,MySql.Data.MySqlClient.MySqlParameter[])">
\r
3718 Executes a single SQL command and returns the resultset in a <see cref="T:System.Data.DataSet"/>.
\r
3719 The state of the <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object remains unchanged after execution
\r
3722 <param name="connection"><see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object to use</param>
\r
3723 <param name="commandText">Command to execute</param>
\r
3724 <param name="commandParameters">Parameters to use for the command</param>
\r
3725 <returns><see cref="T:System.Data.DataSet"/> containing the resultset</returns>
\r
3727 <member name="M:MySql.Data.MySqlClient.MySqlHelper.UpdateDataSet(System.String,System.String,System.Data.DataSet,System.String)">
\r
3729 Updates the given table with data from the given <see cref="T:System.Data.DataSet"/>
\r
3731 <param name="connectionString">Settings to use for the update</param>
\r
3732 <param name="commandText">Command text to use for the update</param>
\r
3733 <param name="ds"><see cref="T:System.Data.DataSet"/> containing the new data to use in the update</param>
\r
3734 <param name="tablename">Tablename in the dataset to update</param>
\r
3736 <member name="M:MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(MySql.Data.MySqlClient.MySqlConnection,MySql.Data.MySqlClient.MySqlTransaction,System.String,MySql.Data.MySqlClient.MySqlParameter[],System.Boolean)">
\r
3738 Executes a single command against a MySQL database, possibly inside an existing transaction.
\r
3740 <param name="connection"><see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object to use for the command</param>
\r
3741 <param name="transaction"><see cref="T:MySql.Data.MySqlClient.MySqlTransaction"/> object to use for the command</param>
\r
3742 <param name="commandText">Command text to use</param>
\r
3743 <param name="commandParameters">Array of <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> objects to use with the command</param>
\r
3744 <param name="ExternalConn">True if the connection should be preserved, false if not</param>
\r
3745 <returns><see cref="T:MySql.Data.MySqlClient.MySqlDataReader"/> object ready to read the results of the command</returns>
\r
3747 <member name="M:MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(System.String,System.String)">
\r
3749 Executes a single command against a MySQL database.
\r
3751 <param name="connectionString">Settings to use for this command</param>
\r
3752 <param name="commandText">Command text to use</param>
\r
3753 <returns><see cref="T:MySql.Data.MySqlClient.MySqlDataReader"/> object ready to read the results of the command</returns>
\r
3755 <member name="M:MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(System.String,System.String,MySql.Data.MySqlClient.MySqlParameter[])">
\r
3757 Executes a single command against a MySQL database.
\r
3759 <param name="connectionString">Settings to use for this command</param>
\r
3760 <param name="commandText">Command text to use</param>
\r
3761 <param name="commandParameters">Array of <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> objects to use with the command</param>
\r
3762 <returns><see cref="T:MySql.Data.MySqlClient.MySqlDataReader"/> object ready to read the results of the command</returns>
\r
3764 <member name="M:MySql.Data.MySqlClient.MySqlHelper.ExecuteScalar(System.String,System.String)">
\r
3766 Execute a single command against a MySQL database.
3768 <param name="connectionString">Settings to use for the update</param>
3769 <param name="commandText">Command text to use for the update</param>
3770 <returns>The first column of the first row in the result set, or a null reference if the result set is empty.</returns>
3772 <member name="M:MySql.Data.MySqlClient.MySqlHelper.ExecuteScalar(System.String,System.String,MySql.Data.MySqlClient.MySqlParameter[])">
\r
3774 Execute a single command against a MySQL database.
3776 <param name="connectionString">Settings to use for the command</param>
3777 <param name="commandText">Command text to use for the command</param>
3778 <param name="commandParameters">Parameters to use for the command</param>
3779 <returns>The first column of the first row in the result set, or a null reference if the result set is empty.</returns>
3781 <member name="M:MySql.Data.MySqlClient.MySqlHelper.ExecuteScalar(MySql.Data.MySqlClient.MySqlConnection,System.String)">
\r
3783 Execute a single command against a MySQL database.
\r
3785 <param name="connection"><see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object to use</param>
\r
3786 <param name="commandText">Command text to use for the command</param>
\r
3787 <returns>The first column of the first row in the result set, or a null reference if the result set is empty.</returns>
\r
3789 <member name="M:MySql.Data.MySqlClient.MySqlHelper.ExecuteScalar(MySql.Data.MySqlClient.MySqlConnection,System.String,MySql.Data.MySqlClient.MySqlParameter[])">
\r
3791 Execute a single command against a MySQL database.
\r
3793 <param name="connection"><see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object to use</param>
\r
3794 <param name="commandText">Command text to use for the command</param>
\r
3795 <param name="commandParameters">Parameters to use for the command</param>
\r
3796 <returns>The first column of the first row in the result set, or a null reference if the result set is empty.</returns>
\r
3798 <member name="T:MySql.Data.MySqlClient.MySqlPool">
\r
3800 Summary description for MySqlPool.
3803 <member name="T:MySql.Data.MySqlClient.MySqlPoolManager">
\r
3805 Summary description for MySqlPoolManager.
3808 <member name="M:MySql.Data.MySqlClient.MySqlPoolManager.Initialize">
\r
3813 <member name="T:MySql.Data.MySqlClient.NativeDriver">
\r
3815 Summary description for Driver.
3818 <member name="M:MySql.Data.MySqlClient.NativeDriver.SetDatabase(System.String)">
\r
3820 Sets the current database for the this connection
3822 <param name="dbName"></param>
3824 <member name="M:MySql.Data.MySqlClient.NativeDriver.SetConnectionFlags">
\r
3826 Return the appropriate set of connection flags for our
3827 server capabilities and our user requested options.
3830 <member name="M:MySql.Data.MySqlClient.NativeDriver.Authenticate411">
\r
3831 <summary>Perform an authentication against a 4.1.1 server</summary>
3833 <member name="M:MySql.Data.MySqlClient.NativeDriver.SendFileToServer(System.String)">
\r
3835 Sends the specified file to the server.
3836 This supports the LOAD DATA LOCAL INFILE
3838 <param name="filename"></param>
3840 <member name="P:MySql.Data.MySqlClient.NativeDriver.SupportsBatch">
\r
3842 Returns true if this connection can handle batch SQL natively
3843 This means MySQL 4.1.1 or later.
3846 <member name="T:MySql.Data.MySqlClient.PacketReader">
\r
3848 Summary description for PacketWriter.
\r
3851 <member name="T:MySql.Data.MySqlClient.PacketWriter">
\r
3853 Summary description for PacketWriter.
\r
3856 <member name="M:MySql.Data.MySqlClient.PacketWriter.WriteInteger(System.Int64,System.Int32)">
\r
3860 <param name="v"></param>
\r
3861 <param name="numbytes"></param>
\r
3863 <member name="T:MySql.Data.MySqlClient.MySqlParameter">
\r
3865 Represents a parameter to a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/>, and optionally, its mapping to <see cref="T:System.Data.DataSet"/> columns. This class cannot be inherited.
\r
3868 <member name="M:MySql.Data.MySqlClient.MySqlParameter.#ctor">
\r
3870 Initializes a new instance of the MySqlParameter class.
3873 <member name="M:MySql.Data.MySqlClient.MySqlParameter.#ctor(System.String,System.Object)">
\r
3875 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> class with the parameter name and a value of the new MySqlParameter.
\r
3877 <param name="parameterName">The name of the parameter to map. </param>
\r
3878 <param name="value">An <see cref="T:System.Object"/> that is the value of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/>. </param>
\r
3880 <member name="M:MySql.Data.MySqlClient.MySqlParameter.#ctor(System.String,MySql.Data.MySqlClient.MySqlDbType)">
\r
3882 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> class with the parameter name and the data type.
\r
3884 <param name="parameterName">The name of the parameter to map. </param>
\r
3885 <param name="dbType">One of the <see cref="P:MySql.Data.MySqlClient.MySqlParameter.MySqlDbType"/> values. </param>
\r
3887 <member name="M:MySql.Data.MySqlClient.MySqlParameter.#ctor(System.String,MySql.Data.MySqlClient.MySqlDbType,System.Int32)">
\r
3889 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> class with the parameter name, the <see cref="P:MySql.Data.MySqlClient.MySqlParameter.MySqlDbType"/>, and the size.
\r
3891 <param name="parameterName">The name of the parameter to map. </param>
\r
3892 <param name="dbType">One of the <see cref="P:MySql.Data.MySqlClient.MySqlParameter.MySqlDbType"/> values. </param>
\r
3893 <param name="size">The length of the parameter. </param>
\r
3895 <member name="M:MySql.Data.MySqlClient.MySqlParameter.#ctor(System.String,MySql.Data.MySqlClient.MySqlDbType,System.Int32,System.String)">
\r
3897 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> class with the parameter name, the <see cref="P:MySql.Data.MySqlClient.MySqlParameter.MySqlDbType"/>, the size, and the source column name.
\r
3899 <param name="parameterName">The name of the parameter to map. </param>
\r
3900 <param name="dbType">One of the <see cref="P:MySql.Data.MySqlClient.MySqlParameter.MySqlDbType"/> values. </param>
\r
3901 <param name="size">The length of the parameter. </param>
\r
3902 <param name="sourceColumn">The name of the source column. </param>
\r
3904 <member name="M:MySql.Data.MySqlClient.MySqlParameter.#ctor(System.String,MySql.Data.MySqlClient.MySqlDbType,System.Int32,System.Data.ParameterDirection,System.Boolean,System.Byte,System.Byte,System.String,System.Data.DataRowVersion,System.Object)">
\r
3906 Initializes a new instance of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> class with the parameter name, the type of the parameter, the size of the parameter, a <see cref="T:System.Data.ParameterDirection"/>, the precision of the parameter, the scale of the parameter, the source column, a <see cref="T:System.Data.DataRowVersion"/> to use, and the value of the parameter.
\r
3908 <param name="parameterName">The name of the parameter to map. </param>
\r
3909 <param name="dbType">One of the <see cref="P:MySql.Data.MySqlClient.MySqlParameter.MySqlDbType"/> values. </param>
\r
3910 <param name="size">The length of the parameter. </param>
\r
3911 <param name="direction">One of the <see cref="T:System.Data.ParameterDirection"/> values. </param>
\r
3912 <param name="isNullable">true if the value of the field can be null, otherwise false. </param>
\r
3913 <param name="precision">The total number of digits to the left and right of the decimal point to which <see cref="P:MySql.Data.MySqlClient.MySqlParameter.Value"/> is resolved.</param>
\r
3914 <param name="scale">The total number of decimal places to which <see cref="P:MySql.Data.MySqlClient.MySqlParameter.Value"/> is resolved. </param>
\r
3915 <param name="sourceColumn">The name of the source column. </param>
\r
3916 <param name="sourceVersion">One of the <see cref="T:System.Data.DataRowVersion"/> values. </param>
\r
3917 <param name="value">An <see cref="T:System.Object"/> that is the value of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/>. </param>
\r
3918 <exception cref="T:System.ArgumentException"/>
\r
3920 <member name="M:MySql.Data.MySqlClient.MySqlParameter.ToString">
\r
3922 Overridden. Gets a string containing the <see cref="P:MySql.Data.MySqlClient.MySqlParameter.ParameterName"/>.
\r
3924 <returns></returns>
\r
3926 <member name="P:MySql.Data.MySqlClient.MySqlParameter.DbType">
\r
3928 Gets or sets the <see cref="P:MySql.Data.MySqlClient.MySqlParameter.DbType"/> of the parameter.
\r
3931 <member name="P:MySql.Data.MySqlClient.MySqlParameter.IsUnsigned">
\r
3934 <member name="P:MySql.Data.MySqlClient.MySqlParameter.Direction">
\r
3936 Gets or sets a value indicating whether the parameter is input-only, output-only, bidirectional, or a stored procedure return value parameter.
3937 As of MySql version 4.1 and earlier, input-only is the only valid choice.
3940 <member name="P:MySql.Data.MySqlClient.MySqlParameter.IsNullable">
\r
3942 Gets or sets a value indicating whether the parameter accepts null values.
3945 <member name="P:MySql.Data.MySqlClient.MySqlParameter.MySqlDbType">
\r
3947 Gets or sets the MySqlDbType of the parameter.
3950 <member name="P:MySql.Data.MySqlClient.MySqlParameter.ParameterName">
\r
3952 Gets or sets the name of the MySqlParameter.
3955 <member name="P:MySql.Data.MySqlClient.MySqlParameter.Precision">
\r
3957 Gets or sets the maximum number of digits used to represent the <see cref="P:MySql.Data.MySqlClient.MySqlParameter.Value"/> property.
\r
3960 <member name="P:MySql.Data.MySqlClient.MySqlParameter.Scale">
\r
3962 Gets or sets the number of decimal places to which <see cref="P:MySql.Data.MySqlClient.MySqlParameter.Value"/> is resolved.
\r
3965 <member name="P:MySql.Data.MySqlClient.MySqlParameter.Size">
\r
3967 Gets or sets the maximum size, in bytes, of the data within the column.
3970 <member name="P:MySql.Data.MySqlClient.MySqlParameter.SourceColumn">
\r
3972 Gets or sets the name of the source column that is mapped to the <see cref="T:System.Data.DataSet"/> and used for loading or returning the <see cref="P:MySql.Data.MySqlClient.MySqlParameter.Value"/>.
\r
3975 <member name="P:MySql.Data.MySqlClient.MySqlParameter.SourceVersion">
\r
3977 Gets or sets the <see cref="T:System.Data.DataRowVersion"/> to use when loading <see cref="P:MySql.Data.MySqlClient.MySqlParameter.Value"/>.
\r
3980 <member name="P:MySql.Data.MySqlClient.MySqlParameter.Value">
\r
3982 Gets or sets the value of the parameter.
3985 <member name="T:MySql.Data.MySqlClient.MySqlParameterCollection">
\r
3987 Represents a collection of parameters relevant to a <see cref="T:MySql.Data.MySqlClient.MySqlCommand"/> as well as their respective mappings to columns in a <see cref="T:System.Data.DataSet"/>. This class cannot be inherited.
\r
3990 The number of the parameters in the collection must be equal to the number of
\r
3991 parameter placeholders within the command text, or an exception will be generated.
\r
3992 </remarks><example>
\r
3993 The following example creates multiple instances of <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/>
\r
3994 through the <B>MySqlParameterCollection</B> collection within the <see cref="T:MySql.Data.MySqlClient.MySqlDataAdapter"/>.
\r
3995 These parameters are used to select data within the data source and place the data in
\r
3996 the <see cref="T:System.Data.DataSet"/>. This code assumes that a <B>DataSet</B> and a <B>MySqlDataAdapter</B>
\r
3997 have already been created with the appropriate schema, commands, and connection.
\r
3998 <code lang="Visual Basic">
\r
3999 Public Sub AddParameters()
\r
4001 ' create myDataSet and myDataAdapter
\r
4003 myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters"
\r
4004 myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239
\r
4006 myDataAdapter.Fill(myDataSet)
\r
4007 End Sub 'AddSqlParameters
\r
4010 public void AddSqlParameters()
\r
4013 // create myDataSet and myDataAdapter
\r
4016 myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters";
\r
4017 myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239;
\r
4018 myDataAdapter.Fill(myDataSet);
\r
4024 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.CopyTo(System.Array,System.Int32)">
\r
4026 Copies MySqlParameter objects from the MySqlParameterCollection to the specified array.
4028 <param name="array"></param>
4029 <param name="index"></param>
4031 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.Clear">
\r
4033 Removes all items from the collection.
4036 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.Contains(System.Object)">
\r
4038 Gets a value indicating whether a MySqlParameter exists in the collection.
\r
4040 <param name="value">The value of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object to find. </param>
\r
4041 <returns>true if the collection contains the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object; otherwise, false.</returns>
\r
4042 <overloads>Gets a value indicating whether a <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> exists in the collection.</overloads>
\r
4044 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.IndexOf(System.Object)">
\r
4046 Gets the location of a <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> in the collection.
\r
4048 <param name="value">The <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object to locate. </param>
\r
4049 <returns>The zero-based location of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> in the collection.</returns>
\r
4050 <overloads>Gets the location of a <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> in the collection.</overloads>
\r
4052 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.Insert(System.Int32,System.Object)">
\r
4054 Inserts a MySqlParameter into the collection at the specified index.
4056 <param name="index"></param>
4057 <param name="value"></param>
4059 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.Remove(System.Object)">
\r
4061 Removes the specified MySqlParameter from the collection.
4063 <param name="value"></param>
4065 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.RemoveAt(System.Int32)">
\r
4067 Removes the specified <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> from the collection using a specific index.
\r
4069 <param name="index">The zero-based index of the parameter. </param>
\r
4070 <overloads>Removes the specified <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> from the collection.</overloads>
\r
4072 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.Add(System.Object)">
\r
4074 Adds the specified <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object to the <see cref="T:MySql.Data.MySqlClient.MySqlParameterCollection"/>.
\r
4076 <param name="value">The <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> to add to the collection.</param>
\r
4077 <returns>The index of the new <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object.</returns>
\r
4079 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.Contains(System.String)">
\r
4081 Gets a value indicating whether a <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> with the specified parameter name exists in the collection.
\r
4083 <param name="name">The name of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object to find.</param>
\r
4084 <returns>true if the collection contains the parameter; otherwise, false.</returns>
\r
4086 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.IndexOf(System.String)">
\r
4088 Gets the location of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> in the collection with a specific parameter name.
\r
4090 <param name="parameterName">The name of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object to retrieve. </param>
\r
4091 <returns>The zero-based location of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> in the collection.</returns>
\r
4093 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.RemoveAt(System.String)">
\r
4095 Removes the specified <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> from the collection using the parameter name.
\r
4097 <param name="name">The name of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object to retrieve. </param>
\r
4099 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.Add(MySql.Data.MySqlClient.MySqlParameter)">
\r
4101 Adds the specified <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object to the <see cref="T:MySql.Data.MySqlClient.MySqlParameterCollection"/>.
\r
4103 <param name="value">The <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> to add to the collection.</param>
\r
4104 <returns>The newly added <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object.</returns>
\r
4106 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.Add(System.String,System.Object)">
\r
4108 Adds a <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> to the <see cref="T:MySql.Data.MySqlClient.MySqlParameterCollection"/> given the specified parameter name and value.
\r
4110 <param name="parameterName">The name of the parameter.</param>
\r
4111 <param name="value">The <see cref="P:MySql.Data.MySqlClient.MySqlParameter.Value"/> of the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> to add to the collection.</param>
\r
4112 <returns>The newly added <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object.</returns>
\r
4114 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.Add(System.String,MySql.Data.MySqlClient.MySqlDbType)">
\r
4116 Adds a <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> to the <see cref="T:MySql.Data.MySqlClient.MySqlParameterCollection"/> given the parameter name and the data type.
\r
4118 <param name="parameterName">The name of the parameter.</param>
\r
4119 <param name="dbType">One of the <see cref="T:MySql.Data.MySqlClient.MySqlDbType"/> values. </param>
\r
4120 <returns>The newly added <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object.</returns>
\r
4122 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.Add(System.String,MySql.Data.MySqlClient.MySqlDbType,System.Int32)">
\r
4124 Adds a <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> to the <see cref="T:MySql.Data.MySqlClient.MySqlParameterCollection"/> with the parameter name, the data type, and the column length.
\r
4126 <param name="parameterName">The name of the parameter.</param>
\r
4127 <param name="dbType">One of the <see cref="T:MySql.Data.MySqlClient.MySqlDbType"/> values. </param>
\r
4128 <param name="size">The length of the column.</param>
\r
4129 <returns>The newly added <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object.</returns>
\r
4131 <member name="M:MySql.Data.MySqlClient.MySqlParameterCollection.Add(System.String,MySql.Data.MySqlClient.MySqlDbType,System.Int32,System.String)">
\r
4133 Adds a <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> to the <see cref="T:MySql.Data.MySqlClient.MySqlParameterCollection"/> with the parameter name, the data type, the column length, and the source column name.
\r
4135 <param name="parameterName">The name of the parameter.</param>
\r
4136 <param name="dbType">One of the <see cref="T:MySql.Data.MySqlClient.MySqlDbType"/> values. </param>
\r
4137 <param name="size">The length of the column.</param>
\r
4138 <param name="sourceColumn">The name of the source column.</param>
\r
4139 <returns>The newly added <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> object.</returns>
\r
4141 <member name="P:MySql.Data.MySqlClient.MySqlParameterCollection.Count">
\r
4143 Gets the number of MySqlParameter objects in the collection.
4146 <member name="P:MySql.Data.MySqlClient.MySqlParameterCollection.Item(System.Int32)">
\r
4148 Gets the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> at the specified index.
\r
4150 <overloads>Gets the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> with a specified attribute.
\r
4151 [C#] In C#, this property is the indexer for the <see cref="T:MySql.Data.MySqlClient.MySqlParameterCollection"/> class.
\r
4154 <member name="P:MySql.Data.MySqlClient.MySqlParameterCollection.Item(System.String)">
\r
4156 Gets the <see cref="T:MySql.Data.MySqlClient.MySqlParameter"/> with the specified name.
\r
4159 <member name="T:MySql.Data.MySqlClient.PreparedStatement">
\r
4161 Summary description for PreparedStatement.
\r
4164 <member name="T:MySql.Data.MySqlClient.SharedMemoryStream">
\r
4166 Summary description for SharedMemoryStream.
\r
4169 <member name="T:MySql.Data.MySqlClient.StoredProcedure">
\r
4171 Summary description for StoredProcedure.
\r
4174 <member name="M:MySql.Data.MySqlClient.StoredProcedure.Prepare(MySql.Data.MySqlClient.MySqlCommand)">
\r
4176 Creates the proper command text for executing the given stored procedure
\r
4178 <param name="cmd"></param>
\r
4179 <returns></returns>
\r
4181 <member name="T:MySql.Data.MySqlClient.MySqlTransaction">
\r
4183 Represents a SQL transaction to be made in a MySQL database. This class cannot be inherited.
\r
4184 </summary><remarks>
\r
4185 The application creates a <B>MySqlTransaction</B> object by calling <see cref="M:MySql.Data.MySqlClient.MySqlConnection.BeginTransaction"/>
\r
4186 on the <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object. All subsequent operations associated with the
\r
4187 transaction (for example, committing or aborting the transaction), are performed on the
\r
4188 <B>MySqlTransaction</B> object.
\r
4189 </remarks><example>
\r
4190 The following example creates a <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> and a <B>MySqlTransaction</B>.
\r
4191 It also demonstrates how to use the <see cref="M:MySql.Data.MySqlClient.MySqlConnection.BeginTransaction"/>,
\r
4192 <see cref="M:MySql.Data.MySqlClient.MySqlTransaction.Commit"/>, and <see cref="M:MySql.Data.MySqlClient.MySqlTransaction.Rollback"/> methods.
\r
4193 <code lang="Visual Basic">
\r
4194 Public Sub RunTransaction(myConnString As String)
\r
4195 Dim myConnection As New MySqlConnection(myConnString)
\r
4196 myConnection.Open()
\r
4198 Dim myCommand As MySqlCommand = myConnection.CreateCommand()
\r
4199 Dim myTrans As MySqlTransaction
\r
4201 ' Start a local transaction
\r
4202 myTrans = myConnection.BeginTransaction()
\r
4203 ' Must assign both transaction object and connection
\r
4204 ' to Command object for a pending local transaction
\r
4205 myCommand.Connection = myConnection
\r
4206 myCommand.Transaction = myTrans
\r
4209 myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')"
\r
4210 myCommand.ExecuteNonQuery()
\r
4211 myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')"
\r
4212 myCommand.ExecuteNonQuery()
\r
4214 Console.WriteLine("Both records are written to database.")
\r
4215 Catch e As Exception
\r
4217 myTrans.Rollback()
\r
4218 Catch ex As MySqlException
\r
4219 If Not myTrans.Connection Is Nothing Then
\r
4220 Console.WriteLine("An exception of type " & ex.GetType().ToString() & _
\r
4221 " was encountered while attempting to roll back the transaction.")
\r
4225 Console.WriteLine("An exception of type " & e.GetType().ToString() & _
\r
4226 "was encountered while inserting the data.")
\r
4227 Console.WriteLine("Neither record was written to database.")
\r
4229 myConnection.Close()
\r
4231 End Sub 'RunTransaction
\r
4234 public void RunTransaction(string myConnString)
\r
4236 MySqlConnection myConnection = new MySqlConnection(myConnString);
\r
4237 myConnection.Open();
\r
4239 MySqlCommand myCommand = myConnection.CreateCommand();
\r
4240 MySqlTransaction myTrans;
\r
4242 // Start a local transaction
\r
4243 myTrans = myConnection.BeginTransaction();
\r
4244 // Must assign both transaction object and connection
\r
4245 // to Command object for a pending local transaction
\r
4246 myCommand.Connection = myConnection;
\r
4247 myCommand.Transaction = myTrans;
\r
4251 myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')";
\r
4252 myCommand.ExecuteNonQuery();
\r
4253 myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')";
\r
4254 myCommand.ExecuteNonQuery();
\r
4256 Console.WriteLine("Both records are written to database.");
\r
4258 catch(Exception e)
\r
4262 myTrans.Rollback();
\r
4264 catch (MySqlException ex)
\r
4266 if (myTrans.Connection != null)
\r
4268 Console.WriteLine("An exception of type " + ex.GetType() +
\r
4269 " was encountered while attempting to roll back the transaction.");
\r
4273 Console.WriteLine("An exception of type " + e.GetType() +
\r
4274 " was encountered while inserting the data.");
\r
4275 Console.WriteLine("Neither record was written to database.");
\r
4279 myConnection.Close();
\r
4285 <member name="M:MySql.Data.MySqlClient.MySqlTransaction.Commit">
\r
4287 Commits the database transaction.
\r
4288 </summary><remarks>
\r
4289 The <b>Commit</b> method is equivalent to the MySQL SQL statement
\r
4291 </remarks><example>
\r
4292 The following example creates <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> and a
\r
4293 <see cref="T:MySql.Data.MySqlClient.MySqlTransaction"/>. It also demonstrates how to use the
\r
4294 <see cref="M:MySql.Data.MySqlClient.MySqlConnection.BeginTransaction"/>, <see cref="M:MySql.Data.MySqlClient.MySqlTransaction.Commit"/>, and <B>Rollback</B>
\r
4296 <code lang="Visual Basic">
\r
4297 Public Sub RunSqlTransaction(myConnString As String)
\r
4298 Dim myConnection As New MySqlConnection(myConnString)
\r
4299 myConnection.Open()
\r
4301 Dim myCommand As MySqlCommand = myConnection.CreateCommand()
\r
4302 Dim myTrans As MySqlTransaction
\r
4304 ' Start a local transaction
\r
4305 myTrans = myConnection.BeginTransaction()
\r
4307 ' Must assign both transaction object and connection
\r
4308 ' to Command object for a pending local transaction
\r
4309 myCommand.Connection = myConnection
\r
4310 myCommand.Transaction = myTrans
\r
4313 myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')"
\r
4314 myCommand.ExecuteNonQuery()
\r
4315 myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')"
\r
4316 myCommand.ExecuteNonQuery()
\r
4318 Console.WriteLine("Success.")
\r
4319 Catch e As Exception
\r
4321 myTrans.Rollback()
\r
4322 Catch ex As MySqlException
\r
4323 If Not myTrans.Connection Is Nothing Then
\r
4324 Console.WriteLine("An exception of type " & ex.GetType().ToString() & _
\r
4325 " was encountered while attempting to roll back the transaction.")
\r
4329 Console.WriteLine("An exception of type " & e.GetType().ToString() & _
\r
4330 "was encountered while inserting the data.")
\r
4331 Console.WriteLine("Neither record was written to database.")
\r
4333 myConnection.Close()
\r
4338 public void RunSqlTransaction(string myConnString)
\r
4340 MySqlConnection myConnection = new MySqlConnection(myConnString);
\r
4341 myConnection.Open();
\r
4343 MySqlCommand myCommand = myConnection.CreateCommand();
\r
4344 MySqlTransaction myTrans;
\r
4346 // Start a local transaction
\r
4347 myTrans = myConnection.BeginTransaction();
\r
4348 // Must assign both transaction object and connection
\r
4349 // to Command object for a pending local transaction
\r
4350 myCommand.Connection = myConnection;
\r
4351 myCommand.Transaction = myTrans;
\r
4355 myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')";
\r
4356 myCommand.ExecuteNonQuery();
\r
4357 myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')";
\r
4358 myCommand.ExecuteNonQuery();
\r
4360 Console.WriteLine("Both records are written to database.");
\r
4362 catch(Exception e)
\r
4366 myTrans.Rollback();
\r
4368 catch (MySqlException ex)
\r
4370 if (myTrans.Connection != null)
\r
4372 Console.WriteLine("An exception of type " + ex.GetType() +
\r
4373 " was encountered while attempting to roll back the transaction.");
\r
4377 Console.WriteLine("An exception of type " + e.GetType() +
\r
4378 " was encountered while inserting the data.");
\r
4379 Console.WriteLine("Neither record was written to database.");
\r
4383 myConnection.Close();
\r
4389 <member name="M:MySql.Data.MySqlClient.MySqlTransaction.Rollback">
\r
4391 Rolls back a transaction from a pending state.
\r
4392 </summary><remarks>
\r
4393 The Rollback method is equivalent to the MySQL statement ROLLBACK.
\r
4394 The transaction can only be rolled back from a pending state
\r
4395 (after BeginTransaction has been called, but before Commit is
\r
4397 </remarks><example>
\r
4398 The following example creates <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> and a
\r
4399 <see cref="T:MySql.Data.MySqlClient.MySqlTransaction"/>. It also demonstrates how to use the
\r
4400 <see cref="M:MySql.Data.MySqlClient.MySqlConnection.BeginTransaction"/>, <see cref="M:MySql.Data.MySqlClient.MySqlTransaction.Commit"/>, and <B>Rollback</B>
\r
4402 <code lang="Visual Basic">
\r
4403 Public Sub RunSqlTransaction(myConnString As String)
\r
4404 Dim myConnection As New MySqlConnection(myConnString)
\r
4405 myConnection.Open()
\r
4407 Dim myCommand As MySqlCommand = myConnection.CreateCommand()
\r
4408 Dim myTrans As MySqlTransaction
\r
4410 ' Start a local transaction
\r
4411 myTrans = myConnection.BeginTransaction()
\r
4413 ' Must assign both transaction object and connection
\r
4414 ' to Command object for a pending local transaction
\r
4415 myCommand.Connection = myConnection
\r
4416 myCommand.Transaction = myTrans
\r
4419 myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')"
\r
4420 myCommand.ExecuteNonQuery()
\r
4421 myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')"
\r
4422 myCommand.ExecuteNonQuery()
\r
4424 Console.WriteLine("Success.")
\r
4425 Catch e As Exception
\r
4427 myTrans.Rollback()
\r
4428 Catch ex As MySqlException
\r
4429 If Not myTrans.Connection Is Nothing Then
\r
4430 Console.WriteLine("An exception of type " & ex.GetType().ToString() & _
\r
4431 " was encountered while attempting to roll back the transaction.")
\r
4435 Console.WriteLine("An exception of type " & e.GetType().ToString() & _
\r
4436 "was encountered while inserting the data.")
\r
4437 Console.WriteLine("Neither record was written to database.")
\r
4439 myConnection.Close()
\r
4444 public void RunSqlTransaction(string myConnString)
\r
4446 MySqlConnection myConnection = new MySqlConnection(myConnString);
\r
4447 myConnection.Open();
\r
4449 MySqlCommand myCommand = myConnection.CreateCommand();
\r
4450 MySqlTransaction myTrans;
\r
4452 // Start a local transaction
\r
4453 myTrans = myConnection.BeginTransaction();
\r
4454 // Must assign both transaction object and connection
\r
4455 // to Command object for a pending local transaction
\r
4456 myCommand.Connection = myConnection;
\r
4457 myCommand.Transaction = myTrans;
\r
4461 myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')";
\r
4462 myCommand.ExecuteNonQuery();
\r
4463 myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')";
\r
4464 myCommand.ExecuteNonQuery();
\r
4466 Console.WriteLine("Both records are written to database.");
\r
4468 catch(Exception e)
\r
4472 myTrans.Rollback();
\r
4474 catch (MySqlException ex)
\r
4476 if (myTrans.Connection != null)
\r
4478 Console.WriteLine("An exception of type " + ex.GetType() +
\r
4479 " was encountered while attempting to roll back the transaction.");
\r
4483 Console.WriteLine("An exception of type " + e.GetType() +
\r
4484 " was encountered while inserting the data.");
\r
4485 Console.WriteLine("Neither record was written to database.");
\r
4489 myConnection.Close();
\r
4495 <member name="P:MySql.Data.MySqlClient.MySqlTransaction.Connection">
\r
4497 Gets the <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object associated with the transaction, or a null reference (Nothing in Visual Basic) if the transaction is no longer valid.
\r
4499 <value>The <see cref="T:MySql.Data.MySqlClient.MySqlConnection"/> object associated with this transaction.</value>
\r
4501 A single application may have multiple database connections, each
\r
4502 with zero or more transactions. This property enables you to
\r
4503 determine the connection object associated with a particular
\r
4504 transaction created by <see cref="M:MySql.Data.MySqlClient.MySqlConnection.BeginTransaction"/>.
\r
4507 <member name="P:MySql.Data.MySqlClient.MySqlTransaction.IsolationLevel">
\r
4509 Specifies the <see cref="P:MySql.Data.MySqlClient.MySqlTransaction.IsolationLevel"/> for this transaction.
\r
4512 The <see cref="P:MySql.Data.MySqlClient.MySqlTransaction.IsolationLevel"/> for this transaction. The default is <b>ReadCommitted</b>.
\r
4515 Parallel transactions are not supported. Therefore, the IsolationLevel
\r
4516 applies to the entire transaction.
\r