Added:
branches/5.1/Documentation/CodeExamples/
branches/5.1/Documentation/CodeExamples/MembershipCodeExample1.xml
branches/5.1/Documentation/CodeExamples/MembershipCodeExample2.xml
branches/5.1/Documentation/CodeExamples/RoleCodeExample1.xml
branches/5.1/Documentation/Content/Advanced Topics/Providers.html
branches/5.1/Documentation/Content/Advanced Topics/aspnetconfig.jpg
Modified:
branches/5.1/Documentation/Content/Advanced Topics/Binary Issues.html
branches/5.1/Documentation/Content/Advanced Topics/Character Sets.html
branches/5.1/Documentation/help.shfb
branches/5.1/Driver/Source/docs/MySqlCommand.xml
branches/5.1/Driver/Source/docs/MySqlCommandBuilder.xml
branches/5.1/Driver/Source/docs/MySqlConnection.xml
branches/5.1/Driver/Source/docs/MySqlConnectionStringBuilder.xml
branches/5.1/Driver/Source/docs/MySqlDataAdapter.xml
branches/5.1/Driver/Source/docs/MySqlDataReader.xml
branches/5.1/Driver/Source/docs/MySqlException.xml
branches/5.1/Driver/Source/docs/MySqlHelper.xml
branches/5.1/Driver/Source/docs/MySqlParameter.xml
branches/5.1/Driver/Source/docs/MySqlParameterCollection.xml
branches/5.1/Driver/Source/docs/MySqlTransaction.xml
branches/5.1/MySql.Web/Providers/Source/MembershipProvider.cs
branches/5.1/MySql.Web/Providers/Source/RoleProvider.cs
Log:
big documentation changes.
documented the membership and role providers (at least some)
moved to october sandcastle release
Added: branches/5.1/Documentation/CodeExamples/MembershipCodeExample1.xml
===================================================================
--- branches/5.1/Documentation/CodeExamples/MembershipCodeExample1.xml (rev 0)
+++ branches/5.1/Documentation/CodeExamples/MembershipCodeExample1.xml 2007-11-02 21:13:58 UTC (rev 1055)
@@ -0,0 +1,19 @@
+<membership defaultProvider="MySQLMembershipProvider">
+ <providers>
+ <add name="MySqlMembershipProvider"
+ type="MySql.Web.Security.MySQLMembershipProvider"
+ connectionStringName="LocalMySqlServer"
+ enablePasswordRetrieval="true"
+ enablePasswordReset="false"
+ requiresQuestionAndAnswer="true"
+ requiresUniqueEmail="false"
+ passwordFormat="Encrypted"
+ maxInvalidPasswordAttempts="3"
+ passwordAttemptWindow="20"
+ minRequiredNonAlphanumericCharacters="1"
+ minRequiredPasswordLength="11"
+ passwordStrengthRegularExpression="@\"(?=.{6,})(?=(.*\d){1,})(?=(.*\W){1,})"
+ applicationName="MyApplication" />
+ </providers>
+</membership>
+
Added: branches/5.1/Documentation/CodeExamples/MembershipCodeExample2.xml
===================================================================
--- branches/5.1/Documentation/CodeExamples/MembershipCodeExample2.xml (rev 0)
+++ branches/5.1/Documentation/CodeExamples/MembershipCodeExample2.xml 2007-11-02 21:13:58 UTC (rev 1055)
@@ -0,0 +1,32 @@
+<configuration>
+ <connectionStrings>
+ <add name="LocalMySqlService" connectionString="server=localhost;user id=myuser;password=mypass;database=test" />
+ </connectionStrings>
+ <system.web>
+ <authentication mode="Forms" >
+ <forms loginUrl="login.aspx"
+ name=".ASPXFORMSAUTH" />
+ </authentication>
+ <authorization>
+ <deny users="?" />
+ </authorization>
+ <membership defaultProvider="MySQLProvider"
+ userIsOnlineTimeWindow="15">
+ <providers>
+ <add
+ name="MySQLProvider"
+ type="MySql.Web.Security.MySQLMembershipProvider"
+ connectionStringName="LocalMySqlService"
+ applicationName="MyApplication"
+ enablePasswordRetrieval="false"
+ enablePasswordReset="true"
+ requiresQuestionAndAnswer="true"
+ requiresUniqueEmail="false"
+ passwordFormat="Hashed"
+ maxInvalidPasswordAttempts="5"
+ passwordAttemptWindow="10" />
+ </providers>
+ </membership>
+ </system.web>
+</configuration>
+
Added: branches/5.1/Documentation/CodeExamples/RoleCodeExample1.xml
===================================================================
--- branches/5.1/Documentation/CodeExamples/RoleCodeExample1.xml (rev 0)
+++ branches/5.1/Documentation/CodeExamples/RoleCodeExample1.xml 2007-11-02 21:13:58 UTC (rev 1055)
@@ -0,0 +1,12 @@
+<roleManager defaultProvider="MySqlProvider"
+ enabled="true">
+ <providers>
+ <add
+ name="MySqlProvider"
+ type="MySql.Web.Security.MySQLRoleProvider"
+ connectionStringName="LocalMySqlServices"
+ writeExceptionsToEventLog="false"
+ applicationName="MyApplication" />
+ </providers>
+</roleManager>
+
Modified: branches/5.1/Documentation/Content/Advanced Topics/Binary Issues.html
===================================================================
--- branches/5.1/Documentation/Content/Advanced Topics/Binary Issues.html 2007-11-01 20:58:53 UTC (rev 1054)
+++ branches/5.1/Documentation/Content/Advanced Topics/Binary Issues.html 2007-11-02 21:13:58 UTC (rev 1055)
@@ -1,7 +1,7 @@
<html>
<head>
<title>Binary/Non-Binary Issues</title>
- <link rel="stylesheet" type="text/css" href="../styles/presentation.css" />
+ <link rel="stylesheet" type="text/css" href="../../styles/presentation.css" />
<link rel="stylesheet" type="text/css" href="ms-help://Hx/HxRuntime/HxLink.css" />
<link rel="stylesheet" type="text/css" href="ms-help://Dx/DxRuntime/DxLink.css" />
</head>
Modified: branches/5.1/Documentation/Content/Advanced Topics/Character Sets.html
===================================================================
--- branches/5.1/Documentation/Content/Advanced Topics/Character Sets.html 2007-11-01 20:58:53 UTC (rev 1054)
+++ branches/5.1/Documentation/Content/Advanced Topics/Character Sets.html 2007-11-02 21:13:58 UTC (rev 1055)
@@ -1,7 +1,7 @@
<html>
<head>
<title>Character Sets</title>
- <link rel="stylesheet" type="text/css" href="../styles/presentation.css" />
+ <link rel="stylesheet" type="text/css" href="../../styles/presentation.css" />
<link rel="stylesheet" type="text/css" href="ms-help://Hx/HxRuntime/HxLink.css" />
<link rel="stylesheet" type="text/css" href="ms-help://Dx/DxRuntime/DxLink.css" />
</head>
Added: branches/5.1/Documentation/Content/Advanced Topics/Providers.html
===================================================================
--- branches/5.1/Documentation/Content/Advanced Topics/Providers.html (rev 0)
+++ branches/5.1/Documentation/Content/Advanced Topics/Providers.html 2007-11-02 21:13:58 UTC (rev 1055)
@@ -0,0 +1,65 @@
+<html>
+<head>
+ <title>ASP.NET Provider Model</title>
+ <link rel="stylesheet" type="text/css" href="../../styles/presentation.css" />
+ <link rel="stylesheet" type="text/css" href="ms-help://Hx/HxRuntime/HxLink.css" />
+ <link rel="stylesheet" type="text/css" href="ms-help://Dx/DxRuntime/DxLink.css" />
+</head>
+<body>
+ <div id="header">
+ <table id="topTable">
+ <tr id="headerTableRow1">
+ <td align="left">
+ <span id="runningHeaderText">MySQL Connector/Net</span></td>
+ </tr>
+ <tr id="headerTableRow2">
+ <td align="left">
+ <span id="nsrTitle">ASP.NET Provider Model Support</span></td>
+ </tr>
+ </table>
+ </div>
+ <div id="mainSection">
+ <div id="mainBody">
+ <p>
+ MySQL Connector/Net provides support for the ASP.NET 2.0 provider model. This
+ model allows application developers to focus on the business logic of there application
+ instead of having to recreate such boilerplate items as membership and roles support.
+ Currently, only membership and role providers are supplied although session state
+ and profile providers will be provided in upcoming releases.</p>
+ <h4 class="dxh4">
+ Installing The Providers</h4>
+ <p>
+ The installation of Connector/Net 5.1 or later will install the providers and register
+ them in your machines .NET configuration file. The providers are implemented
+ in the file mysql.web.dll and this file can be found in your Connector/Net installation
+ folder. There is no need to run any type of SQL script to setup the database
+ as the providers create and maintain the proper schema automatically.
+ </p>
+ <h4 class="dxh4">
+ Using The Providers</h4>
+ <p>
+ The easiest way to start using the providers is to use the ASP.NET configuration
+ tool that is available on the Solution Explorer toolbar when you have a website
+ project loaded.</p>
+ <p>
+ In the web pages that open you will be able to select the MySQL membership and roles
+ provider by indicating that you want to pick a custom provider for each area.</p>
+ <img src="aspnetconfig.jpg" />
+ <h4 class="dxh4">
+ Distribution</h4>
+ <p>
+ To use the providers on a production server you will need to distribute the MySql.Data
+ and the MySql.Web assemblies and either register them in the remote systems Global
+ Assembly Cache or keep them in your applications bin folder.
+ </p>
+ <p>
+ </p>
+ <p>
+ <img width="100%" height="3px" src="../icons/footer.gif" alt="Footer image"></img>
+ </p>
+ <include item="copyright" />
+ </div>
+ </div>
+</body>
+</html>
+<!-- @SortOrder 2 -->
Added: branches/5.1/Documentation/Content/Advanced Topics/aspnetconfig.jpg
===================================================================
(Binary files differ)
Property changes on: branches/5.1/Documentation/Content/Advanced Topics/aspnetconfig.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/5.1/Documentation/help.shfb
===================================================================
--- branches/5.1/Documentation/help.shfb 2007-11-01 20:58:53 UTC (rev 1054)
+++ branches/5.1/Documentation/help.shfb 2007-11-02 21:13:58 UTC (rev 1055)
@@ -1,6 +1,7 @@
-<project schemaVersion="1.4.0.2">
+<project schemaVersion="1.6.0.1">
<assemblies>
<assembly assemblyPath="..\Driver\bin\net-2.0\release\MySql.Data.dll" xmlCommentsPath="..\Driver\bin\net-2.0\release\MySql.Data.xml" commentsOnly="False" />
+ <assembly assemblyPath="..\MySql.Web\Providers\bin\Release\MySql.Web.dll" xmlCommentsPath="..\MySql.Web\Providers\bin\Release\doc.xml" commentsOnly="False" />
</assemblies>
<namespaceSummaries>
<namespaceSummaryItem name="" isDocumented="False" />
@@ -22,6 +23,14 @@
<contentItem sourcePath=".\Content\Integration\Visual Studio 2005\.svn\*.*" destPath="" excludeItems="True" />
<contentItem sourcePath=".\Content\Integration\Visual Studio 2005\Editing Tables\.svn\*.*" destPath="" excludeItems="True" />
</additionalContent>
+ <apiFilter>
+ <filter entryType="Namespace" fullName="MySql.Data.MySqlClient" isExposed="True">
+ <filter entryType="Class" fullName="MySql.Data.MySqlClient.CustomInstaller" filterName="CustomInstaller" isExposed="False" />
+ </filter>
+ <filter entryType="Namespace" fullName="MySql.Web.Security" isExposed="True">
+ <filter entryType="Class" fullName="MySql.Web.Security.CustomInstaller" filterName="CustomInstaller" isExposed="False" />
+ </filter>
+ </apiFilter>
<ProjectSummary />
<MissingTags>Summary, Parameter, Returns</MissingTags>
<VisibleItems>InheritedMembers, InheritedFrameworkMembers, Protected, SealedProtected</VisibleItems>
@@ -31,6 +40,7 @@
<SandcastlePath path="" />
<WorkingPath path="" />
<CleanIntermediates>False</CleanIntermediates>
+ <KeepLogFile>True</KeepLogFile>
<HelpFileFormat>Help1xAndHelp2x</HelpFileFormat>
<PurgeDuplicateTopics>True</PurgeDuplicateTopics>
<CppCommentsFixup>False</CppCommentsFixup>
@@ -44,14 +54,18 @@
<HtmlHelpName>MySql.Data</HtmlHelpName>
<Language>en-US</Language>
<CopyrightHref>http://www.mysql.com</CopyrightHref>
- <CopyrightText>� 2004-2007 MySQL AB. All rights reserved.</CopyrightText>
+ <CopyrightText>© 2004-2007 MySQL AB. All rights reserved.</CopyrightText>
<FeedbackEMailAddress>support@stripped</FeedbackEMailAddress>
<HeaderText />
<FooterText />
<ProjectLinkType>Local</ProjectLinkType>
<SdkLinkType>Msdn</SdkLinkType>
+ <SdkLinkTarget>Blank</SdkLinkTarget>
<PresentationStyle>vs2005</PresentationStyle>
<NamingMethod>MemberName</NamingMethod>
<SyntaxFilters>Standard</SyntaxFilters>
+ <ShowFeedbackControl>False</ShowFeedbackControl>
<ContentPlacement>AboveNamespaces</ContentPlacement>
+ <ContentSiteMap path="" />
+ <TopicFileTransform path="" />
</project>
\ No newline at end of file
Modified: branches/5.1/Driver/Source/docs/MySqlCommand.xml
===================================================================
--- branches/5.1/Driver/Source/docs/MySqlCommand.xml 2007-11-01 20:58:53 UTC (rev 1054)
+++ branches/5.1/Driver/Source/docs/MySqlCommand.xml 2007-11-02 21:13:58 UTC (rev 1055)
@@ -1,706 +1,830 @@
<docs>
-<ClassSummary>
- <summary>Represents a SQL statement to execute against a MySQL database. This class cannot be inherited.</summary>
- <remarks>
- <B>MySqlCommand</B> features the following methods for executing commands at a MySQL database:
- <list type="table">
- <listheader><term>Item</term><term>Description</term></listheader>
- <item>
- <term><a href="MySql.Data.MySqlClient.MySqlCommand.ExecuteReader_overloads.html">ExecuteReader</a></term>
- <description>Executes commands that return rows.</description>
- </item>
- <item>
- <term><a href="MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery.html">ExecuteNonQuery</a></term>
- <description>Executes commands such as SQL INSERT, DELETE, and UPDATE statements.</description>
- </item>
- <item>
- <term><a href="MySql.Data.MySqlClient.MySqlCommand.ExecuteScalar.html">ExecuteScalar</a></term>
- <description>Retrieves a single value (for example, an aggregate value) from a database.</description>
- </item>
- </list>
+ <ClassSummary>
+ <summary>Represents a SQL statement to execute against a MySQL database. This class cannot be inherited.</summary>
+ <remarks>
+ <B>MySqlCommand</B> features the following methods for executing commands at a MySQL database:
+ <list type="table">
+ <listheader>
+ <term>Item</term>
+ <term>Description</term>
+ </listheader>
+ <item>
+ <term>
+ <a href="MySql.Data.MySqlClient.MySqlCommand.ExecuteReader_overloads.html">ExecuteReader</a>
+ </term>
+ <description>Executes commands that return rows.</description>
+ </item>
+ <item>
+ <term>
+ <a href="MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery.html">ExecuteNonQuery</a>
+ </term>
+ <description>Executes commands such as SQL INSERT, DELETE, and UPDATE statements.</description>
+ </item>
+ <item>
+ <term>
+ <a href="MySql.Data.MySqlClient.MySqlCommand.ExecuteScalar.html">ExecuteScalar</a>
+ </term>
+ <description>Retrieves a single value (for example, an aggregate value) from a database.</description>
+ </item>
+ </list>
- You can reset the <B>CommandText</B> property and reuse the <B>MySqlCommand</B>
- object. However, you must close the <A
- href="MySql.Data.MySqlClient.MySqlDataReader.html">MySqlDataReader</A>
- before you can execute a new or previous command.
+ You can reset the <B>CommandText</B> property and reuse the <B>MySqlCommand</B>
+ object. However, you must close the <A
+ href="MySql.Data.MySqlClient.MySqlDataReader.html">MySqlDataReader</A>
+ before you can execute a new or previous command.
- If a <A href="MySql.Data.MySqlClient.MySqlException.html">MySqlException</A> is
- generated by the method executing a <B>MySqlCommand</B>, the <A
- href="MySql.Data.MySqlClient.MySqlConnection.html">MySqlConnection</A>
- remains open. It is the responsibility of the programmer to close the connection.
-
- <note>
- Prior versions of the provider used the '@' symbol to mark parameters in SQL. This is incompatible
- with MySQL user variables, so the provider now uses the '?' symbol to locate parameters in SQL. To
- support older code, you can set 'old syntax=yes' on your connection string. If you do this, please
- be aware that an exception will not be throw if you fail to define a parameter that you intended to
- use in your SQL.
- </note>
- </remarks>
+ If a <A href="MySql.Data.MySqlClient.MySqlException.html">MySqlException</A> is
+ generated by the method executing a <B>MySqlCommand</B>, the <A
+ href="MySql.Data.MySqlClient.MySqlConnection.html">MySqlConnection</A>
+ remains open. It is the responsibility of the programmer to close the connection.
- <example>
- The following example creates a <A href="frlrfsystemdatasqlclientsqlcommandclasstopic.htm">MySqlCommand</A> and
- a <B>MySqlConnection</B>. The <B>MySqlConnection</B> is opened and set as the <A
- href="frlrfsystemdatasqlclientsqlcommandclassconnectiontopic.htm">Connection</A>
- for the <B>MySqlCommand</B>. The example then calls <A
- href="frlrfsystemdatasqlclientsqlcommandclassexecutenonquerytopic.htm">ExecuteNonQuery</A>,
- and closes the connection. To accomplish this, the <B>ExecuteNonQuery</B> is
- passed a connection string and a query string that is a SQL INSERT
- statement.
- <code lang="Visual Basic">
- Public Sub InsertRow(myConnectionString As String)
- " If the connection string is null, use a default.
- If myConnectionString = "" Then
- myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"
- End If
- Dim myConnection As New MySqlConnection(myConnectionString)
- Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"
- Dim myCommand As New MySqlCommand(myInsertQuery)
- myCommand.Connection = myConnection
- myConnection.Open()
- myCommand.ExecuteNonQuery()
- myCommand.Connection.Close()
- End Sub
- </code>
- <code lang="C#">
- public void InsertRow(string myConnectionString)
- {
- // If the connection string is null, use a default.
- if(myConnectionString == "")
- {
- myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass";
- }
- MySqlConnection myConnection = new MySqlConnection(myConnectionString);
- string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)";
- MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
- myCommand.Connection = myConnection;
- myConnection.Open();
- myCommand.ExecuteNonQuery();
- myCommand.Connection.Close();
- }
- </code>
- </example>
-</ClassSummary>
+ <note>
+ Prior versions of the provider used the '@' symbol to mark parameters in SQL. This is incompatible
+ with MySQL user variables, so the provider now uses the '?' symbol to locate parameters in SQL. To
+ support older code, you can set 'old syntax=yes' on your connection string. If you do this, please
+ be aware that an exception will not be throw if you fail to define a parameter that you intended to
+ use in your SQL.
+ </note>
+ </remarks>
+ <example>
+ The following example creates a <A href="frlrfsystemdatasqlclientsqlcommandclasstopic.htm">MySqlCommand</A> and
+ a <B>MySqlConnection</B>. The <B>MySqlConnection</B> is opened and set as the <A
+ href="frlrfsystemdatasqlclientsqlcommandclassconnectiontopic.htm">Connection</A>
+ for the <B>MySqlCommand</B>. The example then calls <A
+ href="frlrfsystemdatasqlclientsqlcommandclassexecutenonquerytopic.htm">ExecuteNonQuery</A>,
+ and closes the connection. To accomplish this, the <B>ExecuteNonQuery</B> is
+ passed a connection string and a query string that is a SQL INSERT
+ statement.
+ <code lang="vbnet">
+ Public Sub InsertRow(myConnectionString As String)
+ " If the connection string is null, use a default.
+ If myConnectionString = "" Then
+ myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"
+ End If
+ Dim myConnection As New MySqlConnection(myConnectionString)
+ Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"
+ Dim myCommand As New MySqlCommand(myInsertQuery)
+ myCommand.Connection = myConnection
+ myConnection.Open()
+ myCommand.ExecuteNonQuery()
+ myCommand.Connection.Close()
+ End Sub
+ </code>
+ <code lang="C#">
+ public void InsertRow(string myConnectionString)
+ {
+ // If the connection string is null, use a default.
+ if(myConnectionString == "")
+ {
+ myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass";
+ }
+ MySqlConnection myConnection = new MySqlConnection(myConnectionString);
+ string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)";
+ MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
+ myCommand.Connection = myConnection;
+ myConnection.Open();
+ myCommand.ExecuteNonQuery();
+ myCommand.Connection.Close();
+ }
+ </code>
+ </example>
+ </ClassSummary>
-<ctor1>
- <overloads>
- <summary>
- Initializes a new instance of the MySqlCommand class.
- </summary>
- <example>
- The following example creates a MySqlCommand and sets some of its properties.
- <para></para>
- <note>This example shows how to use one of the overloaded
- versions of the MySqlCommand constructor. For other examples that might be available,
- see the individual overload topics.
- </note>
-
- <code lang="Visual Basic">
- Public Sub CreateMySqlCommand()
- Dim myConnection As New MySqlConnection _
- ("Persist Security Info=False;database=test;server=myServer")
- myConnection.Open()
- Dim myTrans As MySqlTransaction = myConnection.BeginTransaction()
- Dim mySelectQuery As String = "SELECT * FROM MyTable"
- Dim myCommand As New MySqlCommand(mySelectQuery, myConnection, myTrans)
- myCommand.CommandTimeout = 20
- End Sub
- </code>
- <code lang="C#">
- public void CreateMySqlCommand()
- {
- MySqlConnection myConnection = new MySqlConnection("Persist Security Info=False;
- database=test;server=myServer");
- myConnection.Open();
- MySqlTransaction myTrans = myConnection.BeginTransaction();
- string mySelectQuery = "SELECT * FROM myTable";
- MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection,myTrans);
- myCommand.CommandTimeout = 20;
- }
- </code>
- <code lang="C++">
- public:
- void CreateMySqlCommand()
- {
- MySqlConnection* myConnection = new MySqlConnection(S"Persist Security Info=False;
- database=test;server=myServer");
- myConnection->Open();
- MySqlTransaction* myTrans = myConnection->BeginTransaction();
- String* mySelectQuery = S"SELECT * FROM myTable";
- MySqlCommand* myCommand = new MySqlCommand(mySelectQuery, myConnection, myTrans);
- myCommand->CommandTimeout = 20;
- };
- </code>
- </example>
- </overloads>
+ <ctor1>
+ <overloads>
+ <summary>
+ Initializes a new instance of the MySqlCommand class.
+ </summary>
+ <example>
+ The following example creates a MySqlCommand and sets some of its properties.
+ <para></para>
+ <note>
+ This example shows how to use one of the overloaded
+ versions of the MySqlCommand constructor. For other examples that might be available,
+ see the individual overload topics.
+ </note>
- <summary>
- Initializes a new instance of the MySqlCommand class.
- </summary>
- <remarks>
- The base constructor initializes all fields to their default values. The
- following table shows initial property values for an instance of <see cref="MySqlCommand"/>.
- <list type="table">
- <listheader><term>Properties</term><term>Initial Value</term></listheader>
- <item><term><see cref="CommandText"/></term><term>empty string ("")</term></item>
- <item><term><see cref="CommandTimeout"/></term><term>0</term></item>
- <item><term><see cref="CommandType"/></term><term>CommandType.Text</term></item>
- <item><term><see cref="Connection"/></term><term>Null</term></item>
- </list>
- <para>
- You can change the value for any of these properties through a separate call to
- the property.</para>
- </remarks>
- <example>
- The following example creates a <see cref="MySqlCommand"/> and
- sets some of its properties.
+ <code lang="vbnet">
+ Public Sub CreateMySqlCommand()
+ Dim myConnection As New MySqlConnection _
+ ("Persist Security Info=False;database=test;server=myServer")
+ myConnection.Open()
+ Dim myTrans As MySqlTransaction = myConnection.BeginTransaction()
+ Dim mySelectQuery As String = "SELECT * FROM MyTable"
+ Dim myCommand As New MySqlCommand(mySelectQuery, myConnection, myTrans)
+ myCommand.CommandTimeout = 20
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlCommand()
+ {
+ MySqlConnection myConnection = new MySqlConnection("Persist Security Info=False;
+ database=test;server=myServer");
+ myConnection.Open();
+ MySqlTransaction myTrans = myConnection.BeginTransaction();
+ string mySelectQuery = "SELECT * FROM myTable";
+ MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection,myTrans);
+ myCommand.CommandTimeout = 20;
+ }
+ </code>
+ <code lang="C++">
+ public:
+ void CreateMySqlCommand()
+ {
+ MySqlConnection* myConnection = new MySqlConnection(S"Persist Security Info=False;
+ database=test;server=myServer");
+ myConnection->Open();
+ MySqlTransaction* myTrans = myConnection->BeginTransaction();
+ String* mySelectQuery = S"SELECT * FROM myTable";
+ MySqlCommand* myCommand = new MySqlCommand(mySelectQuery, myConnection, myTrans);
+ myCommand->CommandTimeout = 20;
+ };
+ </code>
+ </example>
+ </overloads>
-<code lang="Visual Basic">
-Public Sub CreateMySqlCommand()
- Dim myCommand As New MySqlCommand()
- myCommand.CommandType = CommandType.Text
-End Sub
-</code>
-<code lang="C#">
-public void CreateMySqlCommand()
-{
- MySqlCommand myCommand = new MySqlCommand();
- myCommand.CommandType = CommandType.Text;
-}
-</code>
- </example>
-</ctor1>
-<ctor2>
- <summary>
- Initializes a new instance of the <see cref="MySqlCommand"/> class with the text of the query.
- </summary>
- <param name="cmdText">The text of the query.</param>
- <remarks>
- When an instance of <see cref="MySqlCommand"/> is created,
- the following read/write properties are set to initial values.
-
- <list type="table">
- <listheader><term>Properties</term><term>Initial Value</term></listheader>
- <item><term><see cref="CommandText"/></term><term><i>cmdText</i></term></item>
- <item><term><see cref="CommandTimeout"/></term><term>0</term></item>
- <item><term><see cref="CommandType"/></term><term>CommandType.Text</term></item>
- <item><term><see cref="Connection"/></term><term>Null</term></item>
- </list>
- <para>
- You can change the value for any of these properties through a separate call to
- the property.</para>
- </remarks>
- <example>
- The following example creates a <see cref="MySqlCommand"/> and
- sets some of its properties.
+ <summary>
+ Initializes a new instance of the MySqlCommand class.
+ </summary>
+ <remarks>
+ The base constructor initializes all fields to their default values. The
+ following table shows initial property values for an instance of <see cref="MySqlCommand"/>.
+ <list type="table">
+ <listheader>
+ <term>Properties</term>
+ <term>Initial Value</term>
+ </listheader>
+ <item>
+ <term>
+ <see cref="CommandText"/>
+ </term>
+ <term>empty string ("")</term>
+ </item>
+ <item>
+ <term>
+ <see cref="CommandTimeout"/>
+ </term>
+ <term>0</term>
+ </item>
+ <item>
+ <term>
+ <see cref="CommandType"/>
+ </term>
+ <term>CommandType.Text</term>
+ </item>
+ <item>
+ <term>
+ <see cref="Connection"/>
+ </term>
+ <term>Null</term>
+ </item>
+ </list>
+ <para>
+ You can change the value for any of these properties through a separate call to
+ the property.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlCommand"/> and
+ sets some of its properties.
-<code lang="Visual Basic">
-Public Sub CreateMySqlCommand()
- Dim sql as String = "SELECT * FROM mytable"
- Dim myCommand As New MySqlCommand(sql)
- myCommand.CommandType = CommandType.Text
-End Sub
-</code>
-<code lang="C#">
-public void CreateMySqlCommand()
-{
- string sql = "SELECT * FROM mytable";
- MySqlCommand myCommand = new MySqlCommand(sql);
- myCommand.CommandType = CommandType.Text;
-}
-</code>
-</example>
-</ctor2>
+ <code lang="vbnet">
+ Public Sub CreateMySqlCommand()
+ Dim myCommand As New MySqlCommand()
+ myCommand.CommandType = CommandType.Text
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlCommand()
+ {
+ MySqlCommand myCommand = new MySqlCommand();
+ myCommand.CommandType = CommandType.Text;
+ }
+ </code>
+ </example>
+ </ctor1>
-<ctor3>
- <summary>
- Initializes a new instance of the <see cref="MySqlCommand"/> class
- with the text of the query and a <see cref="MySqlConnection"/>.
- </summary>
- <param name="cmdText">The text of the query.</param>
- <param name="connection">A <see cref="MySqlConnection"/> that represents the
- connection to an instance of SQL Server.
- </param>
- <remarks>
- When an instance of <see cref="MySqlCommand"/> is created,
- the following read/write properties are set to initial values.
-
- <list type="table">
- <listheader><term>Properties</term><term>Initial Value</term></listheader>
- <item><term><see cref="CommandText"/></term><term><i>cmdText</i></term></item>
- <item><term><see cref="CommandTimeout"/></term><term>0</term></item>
- <item><term><see cref="CommandType"/></term><term>CommandType.Text</term></item>
- <item><term><see cref="Connection"/></term><term><i>connection</i></term></item>
- </list>
- <para>
- You can change the value for any of these properties through a separate call to
- the property.</para>
- </remarks>
- <example>
- The following example creates a <see cref="MySqlCommand"/> and
- sets some of its properties.
+ <ctor2>
+ <summary>
+ Initializes a new instance of the <see cref="MySqlCommand"/> class with the text of the query.
+ </summary>
+ <param name="cmdText">The text of the query.</param>
+ <remarks>
+ When an instance of <see cref="MySqlCommand"/> is created,
+ the following read/write properties are set to initial values.
-<code lang="Visual Basic">
-Public Sub CreateMySqlCommand()
- Dim conn as new MySqlConnection("server=myServer")
- Dim sql as String = "SELECT * FROM mytable"
- Dim myCommand As New MySqlCommand(sql, conn)
- myCommand.CommandType = CommandType.Text
-End Sub
-</code>
-<code lang="C#">
-public void CreateMySqlCommand()
-{
- MySqlConnection conn = new MySqlConnection("server=myserver")
- string sql = "SELECT * FROM mytable";
- MySqlCommand myCommand = new MySqlCommand(sql, conn);
- myCommand.CommandType = CommandType.Text;
-}
-</code>
-</example>
+ <list type="table">
+ <listheader>
+ <term>Properties</term>
+ <term>Initial Value</term>
+ </listheader>
+ <item>
+ <term>
+ <see cref="CommandText"/>
+ </term>
+ <term>
+ <i>cmdText</i>
+ </term>
+ </item>
+ <item>
+ <term>
+ <see cref="CommandTimeout"/>
+ </term>
+ <term>0</term>
+ </item>
+ <item>
+ <term>
+ <see cref="CommandType"/>
+ </term>
+ <term>CommandType.Text</term>
+ </item>
+ <item>
+ <term>
+ <see cref="Connection"/>
+ </term>
+ <term>Null</term>
+ </item>
+ </list>
+ <para>
+ You can change the value for any of these properties through a separate call to
+ the property.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlCommand"/> and
+ sets some of its properties.
+ <code lang="vbnet">
+ Public Sub CreateMySqlCommand()
+ Dim sql as String = "SELECT * FROM mytable"
+ Dim myCommand As New MySqlCommand(sql)
+ myCommand.CommandType = CommandType.Text
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlCommand()
+ {
+ string sql = "SELECT * FROM mytable";
+ MySqlCommand myCommand = new MySqlCommand(sql);
+ myCommand.CommandType = CommandType.Text;
+ }
+ </code>
+ </example>
+ </ctor2>
-</ctor3>
+ <ctor3>
+ <summary>
+ Initializes a new instance of the <see cref="MySqlCommand"/> class
+ with the text of the query and a <see cref="MySqlConnection"/>.
+ </summary>
+ <param name="cmdText">The text of the query.</param>
+ <param name="connection">
+ A <see cref="MySqlConnection"/> that represents the
+ connection to an instance of SQL Server.
+ </param>
+ <remarks>
+ When an instance of <see cref="MySqlCommand"/> is created,
+ the following read/write properties are set to initial values.
-<ctor4>
- <summary>
- Initializes a new instance of the <see cref="MySqlCommand"/> class
- with the text of the query, a <see cref="MySqlConnection"/>, and the
- <see cref="MySqlTransaction"/>.
- </summary>
+ <list type="table">
+ <listheader>
+ <term>Properties</term>
+ <term>Initial Value</term>
+ </listheader>
+ <item>
+ <term>
+ <see cref="CommandText"/>
+ </term>
+ <term>
+ <i>cmdText</i>
+ </term>
+ </item>
+ <item>
+ <term>
+ <see cref="CommandTimeout"/>
+ </term>
+ <term>0</term>
+ </item>
+ <item>
+ <term>
+ <see cref="CommandType"/>
+ </term>
+ <term>CommandType.Text</term>
+ </item>
+ <item>
+ <term>
+ <see cref="Connection"/>
+ </term>
+ <term>
+ <i>connection</i>
+ </term>
+ </item>
+ </list>
+ <para>
+ You can change the value for any of these properties through a separate call to
+ the property.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlCommand"/> and
+ sets some of its properties.
- <param name="cmdText">The text of the query.</param>
- <param name="connection">A <see cref="MySqlConnection"/> that represents the
- connection to an instance of SQL Server.
- </param>
- <param name="transaction">The <see cref="MySqlTransaction"/> in which the <see cref="MySqlCommand"/> executes.</param>
- <remarks>
- When an instance of <see cref="MySqlCommand"/> is created,
- the following read/write properties are set to initial values.
-
- <list type="table">
- <listheader><term>Properties</term><term>Initial Value</term></listheader>
- <item><term><see cref="CommandText"/></term><term><i>cmdText</i></term></item>
- <item><term><see cref="CommandTimeout"/></term><term>0</term></item>
- <item><term><see cref="CommandType"/></term><term>CommandType.Text</term></item>
- <item><term><see cref="Connection"/></term><term><i>connection</i></term></item>
- </list>
- <para>
- You can change the value for any of these properties through a separate call to
- the property.</para>
- </remarks>
- <example>
- The following example creates a <see cref="MySqlCommand"/> and
- sets some of its properties.
+ <code lang="vbnet">
+ Public Sub CreateMySqlCommand()
+ Dim conn as new MySqlConnection("server=myServer")
+ Dim sql as String = "SELECT * FROM mytable"
+ Dim myCommand As New MySqlCommand(sql, conn)
+ myCommand.CommandType = CommandType.Text
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlCommand()
+ {
+ MySqlConnection conn = new MySqlConnection("server=myserver")
+ string sql = "SELECT * FROM mytable";
+ MySqlCommand myCommand = new MySqlCommand(sql, conn);
+ myCommand.CommandType = CommandType.Text;
+ }
+ </code>
+ </example>
-<code lang="Visual Basic">
-Public Sub CreateMySqlCommand()
- Dim conn as new MySqlConnection("server=myServer")
- conn.Open();
- Dim txn as MySqlTransaction = conn.BeginTransaction()
- Dim sql as String = "SELECT * FROM mytable"
- Dim myCommand As New MySqlCommand(sql, conn, txn)
- myCommand.CommandType = CommandType.Text
-End Sub
-</code>
-<code lang="C#">
-public void CreateMySqlCommand()
-{
- MySqlConnection conn = new MySqlConnection("server=myserver")
- conn.Open();
- MySqlTransaction txn = conn.BeginTransaction();
- string sql = "SELECT * FROM mytable";
- MySqlCommand myCommand = new MySqlCommand(sql, conn, txn);
- myCommand.CommandType = CommandType.Text;
-}
-</code>
-</example>
-</ctor4>
+ </ctor3>
+ <ctor4>
+ <summary>
+ Initializes a new instance of the <see cref="MySqlCommand"/> class
+ with the text of the query, a <see cref="MySqlConnection"/>, and the
+ <see cref="MySqlTransaction"/>.
+ </summary>
+ <param name="cmdText">The text of the query.</param>
+ <param name="connection">
+ A <see cref="MySqlConnection"/> that represents the
+ connection to an instance of SQL Server.
+ </param>
+ <param name="transaction">
+ The <see cref="MySqlTransaction"/> in which the <see cref="MySqlCommand"/> executes.
+ </param>
+ <remarks>
+ When an instance of <see cref="MySqlCommand"/> is created,
+ the following read/write properties are set to initial values.
+ <list type="table">
+ <listheader>
+ <term>Properties</term>
+ <term>Initial Value</term>
+ </listheader>
+ <item>
+ <term>
+ <see cref="CommandText"/>
+ </term>
+ <term>
+ <i>cmdText</i>
+ </term>
+ </item>
+ <item>
+ <term>
+ <see cref="CommandTimeout"/>
+ </term>
+ <term>0</term>
+ </item>
+ <item>
+ <term>
+ <see cref="CommandType"/>
+ </term>
+ <term>CommandType.Text</term>
+ </item>
+ <item>
+ <term>
+ <see cref="Connection"/>
+ </term>
+ <term>
+ <i>connection</i>
+ </term>
+ </item>
+ </list>
+ <para>
+ You can change the value for any of these properties through a separate call to
+ the property.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlCommand"/> and
+ sets some of its properties.
-<ExecuteNonQuery>
- <summary>
- Executes a SQL statement against the connection and returns the number of rows affected.
- </summary>
- <returns>Number of rows affected</returns>
- <remarks>
- You can use ExecuteNonQuery to perform any type of database operation,
- however any resultsets returned will not be available. Any output parameters
- used in calling a stored procedure will be populated with data and can be
- retrieved after execution is complete.
- For UPDATE, INSERT, and DELETE statements, the return value is the number
- of rows affected by the command. For all other types of statements, the return
- value is -1.
- </remarks>
- <example>
- The following example creates a MySqlCommand and then
- executes it using ExecuteNonQuery. The example is passed a string that is a
- SQL statement (such as UPDATE, INSERT, or DELETE) and a string to use to
- connect to the data source.
- <code lang="Visual Basic">
- Public Sub CreateMySqlCommand(myExecuteQuery As String, myConnection As MySqlConnection)
- Dim myCommand As New MySqlCommand(myExecuteQuery, myConnection)
- myCommand.Connection.Open()
- myCommand.ExecuteNonQuery()
- myConnection.Close()
- End Sub
- </code>
- <code lang="C#">
- public void CreateMySqlCommand(string myExecuteQuery, MySqlConnection myConnection)
- {
- MySqlCommand myCommand = new MySqlCommand(myExecuteQuery, myConnection);
- myCommand.Connection.Open();
- myCommand.ExecuteNonQuery();
- myConnection.Close();
- }
- </code>
- </example>
-</ExecuteNonQuery>
+ <code lang="vbnet">
+ Public Sub CreateMySqlCommand()
+ Dim conn as new MySqlConnection("server=myServer")
+ conn.Open();
+ Dim txn as MySqlTransaction = conn.BeginTransaction()
+ Dim sql as String = "SELECT * FROM mytable"
+ Dim myCommand As New MySqlCommand(sql, conn, txn)
+ myCommand.CommandType = CommandType.Text
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlCommand()
+ {
+ MySqlConnection conn = new MySqlConnection("server=myserver")
+ conn.Open();
+ MySqlTransaction txn = conn.BeginTransaction();
+ string sql = "SELECT * FROM mytable";
+ MySqlCommand myCommand = new MySqlCommand(sql, conn, txn);
+ myCommand.CommandType = CommandType.Text;
+ }
+ </code>
+ </example>
-<ExecuteReader1>
- <summary>
- Sends the <see cref="CommandText"/> to the <see cref="MySqlConnection">Connection</see>,
- and builds a <see cref="MySqlDataReader"/> using one of the <see cref="CommandBehavior"/> values.
- </summary>
- <param name="behavior">One of the <see cref="CommandBehavior"/> values.</param>
- <remarks>
- <para>
- When the <see cref="CommandType"/> property is set to <B>StoredProcedure</B>,
- the <see cref="CommandText"/> property should be set to the name of the stored
- procedure. The command executes this stored procedure when you call
- <B>ExecuteReader</B>.
- </para>
- <para>
- The <see cref="MySqlDataReader"/> supports a special mode that enables large binary
- values to be read efficiently. For more information, see the <B>SequentialAccess</B>
- setting for <see cref="CommandBehavior"/>.
- </para>
- <para>
- While the <see cref="MySqlDataReader"/> is in use, the associated
- <see cref="MySqlConnection"/> is busy serving the <B>MySqlDataReader</B>.
- While in this state, no other operations can be performed on the
- <B>MySqlConnection</B> other than closing it. This is the case until the
- <see cref="MySqlDataReader.Close"/> method of the <B>MySqlDataReader</B> is called.
- If the <B>MySqlDataReader</B> is created with <B>CommandBehavior</B> set to
- <B>CloseConnection</B>, closing the <B>MySqlDataReader</B> closes the connection
- automatically.
- </para>
- <note>
- When calling ExecuteReader with the SingleRow behavior, you should be aware that using a <i>limit</i>
- clause in your SQL will cause all rows (up to the limit given) to be retrieved by the client. The
- <see cref="MySqlDataReader.Read"/> method will still return false after the first row but pulling all rows of data
- into the client will have a performance impact. If the <i>limit</i> clause is not necessary, it should
- be avoided.
- </note>
- </remarks>
- <returns>A <see cref="MySqlDataReader"/> object.</returns>
-</ExecuteReader1>
+ </ctor4>
-<ExecuteReader>
- <summary>Sends the <see cref="CommandText"/> to the <see cref="MySqlConnection">Connection</see>
- and builds a <see cref="MySqlDataReader"/>.</summary>
- <returns>A <see cref="MySqlDataReader"/> object.</returns>
- <remarks>
- <para>
- When the <see cref="CommandType"/> property is set to <B>StoredProcedure</B>,
- the <see cref="CommandText"/> property should be set to the name of the stored
- procedure. The command executes this stored procedure when you call
- <B>ExecuteReader</B>.
- </para>
- <para>
- While the <see cref="MySqlDataReader"/> is in use, the associated
- <see cref="MySqlConnection"/> is busy serving the <B>MySqlDataReader</B>.
- While in this state, no other operations can be performed on the
- <B>MySqlConnection</B> other than closing it. This is the case until the
- <see cref="MySqlDataReader.Close"/> method of the <B>MySqlDataReader</B> is called.
- </para>
- </remarks>
- <example>
- The following example creates a <see cref="MySqlCommand"/>, then executes it by
- passing a string that is a SQL SELECT statement, and a string to use to connect to the
- data source.
- <code lang="Visual Basic">
-Public Sub CreateMySqlDataReader(mySelectQuery As String, myConnection As MySqlConnection)
- Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
- myConnection.Open()
- Dim myReader As MySqlDataReader
- myReader = myCommand.ExecuteReader()
- Try
- While myReader.Read()
+
+
+ <ExecuteNonQuery>
+ <summary>
+ Executes a SQL statement against the connection and returns the number of rows affected.
+ </summary>
+ <returns>Number of rows affected</returns>
+ <remarks>
+ You can use ExecuteNonQuery to perform any type of database operation,
+ however any resultsets returned will not be available. Any output parameters
+ used in calling a stored procedure will be populated with data and can be
+ retrieved after execution is complete.
+ For UPDATE, INSERT, and DELETE statements, the return value is the number
+ of rows affected by the command. For all other types of statements, the return
+ value is -1.
+ </remarks>
+ <example>
+ The following example creates a MySqlCommand and then
+ executes it using ExecuteNonQuery. The example is passed a string that is a
+ SQL statement (such as UPDATE, INSERT, or DELETE) and a string to use to
+ connect to the data source.
+ <code lang="vbnet">
+ Public Sub CreateMySqlCommand(myExecuteQuery As String, myConnection As MySqlConnection)
+ Dim myCommand As New MySqlCommand(myExecuteQuery, myConnection)
+ myCommand.Connection.Open()
+ myCommand.ExecuteNonQuery()
+ myConnection.Close()
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlCommand(string myExecuteQuery, MySqlConnection myConnection)
+ {
+ MySqlCommand myCommand = new MySqlCommand(myExecuteQuery, myConnection);
+ myCommand.Connection.Open();
+ myCommand.ExecuteNonQuery();
+ myConnection.Close();
+ }
+ </code>
+ </example>
+ </ExecuteNonQuery>
+
+ <ExecuteReader1>
+ <summary>
+ Sends the <see cref="CommandText"/> to the <see cref="MySqlConnection">Connection</see>,
+ and builds a <see cref="MySqlDataReader"/> using one of the <see cref="CommandBehavior"/> values.
+ </summary>
+ <param name="behavior">
+ One of the <see cref="CommandBehavior"/> values.
+ </param>
+ <remarks>
+ <para>
+ When the <see cref="CommandType"/> property is set to <B>StoredProcedure</B>,
+ the <see cref="CommandText"/> property should be set to the name of the stored
+ procedure. The command executes this stored procedure when you call
+ <B>ExecuteReader</B>.
+ </para>
+ <para>
+ The <see cref="MySqlDataReader"/> supports a special mode that enables large binary
+ values to be read efficiently. For more information, see the <B>SequentialAccess</B>
+ setting for <see cref="CommandBehavior"/>.
+ </para>
+ <para>
+ While the <see cref="MySqlDataReader"/> is in use, the associated
+ <see cref="MySqlConnection"/> is busy serving the <B>MySqlDataReader</B>.
+ While in this state, no other operations can be performed on the
+ <B>MySqlConnection</B> other than closing it. This is the case until the
+ <see cref="MySqlDataReader.Close"/> method of the <B>MySqlDataReader</B> is called.
+ If the <B>MySqlDataReader</B> is created with <B>CommandBehavior</B> set to
+ <B>CloseConnection</B>, closing the <B>MySqlDataReader</B> closes the connection
+ automatically.
+ </para>
+ <note>
+ When calling ExecuteReader with the SingleRow behavior, you should be aware that using a <i>limit</i>
+ clause in your SQL will cause all rows (up to the limit given) to be retrieved by the client. The
+ <see cref="MySqlDataReader.Read"/> method will still return false after the first row but pulling all rows of data
+ into the client will have a performance impact. If the <i>limit</i> clause is not necessary, it should
+ be avoided.
+ </note>
+ </remarks>
+ <returns>
+ A <see cref="MySqlDataReader"/> object.
+ </returns>
+ </ExecuteReader1>
+
+
+ <ExecuteReader>
+ <summary>
+ Sends the <see cref="CommandText"/> to the <see cref="MySqlConnection">Connection</see>
+ and builds a <see cref="MySqlDataReader"/>.
+ </summary>
+ <returns>
+ A <see cref="MySqlDataReader"/> object.
+ </returns>
+ <remarks>
+ <para>
+ When the <see cref="CommandType"/> property is set to <B>StoredProcedure</B>,
+ the <see cref="CommandText"/> property should be set to the name of the stored
+ procedure. The command executes this stored procedure when you call
+ <B>ExecuteReader</B>.
+ </para>
+ <para>
+ While the <see cref="MySqlDataReader"/> is in use, the associated
+ <see cref="MySqlConnection"/> is busy serving the <B>MySqlDataReader</B>.
+ While in this state, no other operations can be performed on the
+ <B>MySqlConnection</B> other than closing it. This is the case until the
+ <see cref="MySqlDataReader.Close"/> method of the <B>MySqlDataReader</B> is called.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlCommand"/>, then executes it by
+ passing a string that is a SQL SELECT statement, and a string to use to connect to the
+ data source.
+ <code lang="vbnet">
+ Public Sub CreateMySqlDataReader(mySelectQuery As String, myConnection As MySqlConnection)
+ Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
+ myConnection.Open()
+ Dim myReader As MySqlDataReader
+ myReader = myCommand.ExecuteReader()
+ Try
+ While myReader.Read()
Console.WriteLine(myReader.GetString(0))
- End While
-Finally
- myReader.Close
- myConnection.Close
- End Try
-End Sub
-</code>
-<code lang="C#">
-public void CreateMySqlDataReader(string mySelectQuery, MySqlConnection myConnection)
- {
- MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection);
- myConnection.Open();
- MMySqlDataReader myReader;
- myReader = myCommand.ExecuteReader();
- try
- {
- while(myReader.Read())
- {
+ End While
+ Finally
+ myReader.Close
+ myConnection.Close
+ End Try
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlDataReader(string mySelectQuery, MySqlConnection myConnection)
+ {
+ MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection);
+ myConnection.Open();
+ MMySqlDataReader myReader;
+ myReader = myCommand.ExecuteReader();
+ try
+ {
+ while(myReader.Read())
+ {
Console.WriteLine(myReader.GetString(0));
- }
- }
- finally
- {
- myReader.Close();
- myConnection.Close();
- }
- }
- </code>
- </example>
-</ExecuteReader>
+ }
+ }
+ finally
+ {
+ myReader.Close();
+ myConnection.Close();
+ }
+ }
+ </code>
+ </example>
+ </ExecuteReader>
-<Prepare>
- <summary>
- Creates a prepared version of the command on an instance of MySQL Server.
- </summary>
- <remarks>
- <para>
- Prepared statements are only supported on MySQL version 4.1 and higher. Calling
- prepare while connected to earlier versions of MySQL will succeed but will execute
- the statement in the same way as unprepared.
- </para>
- </remarks>
- <example>
- The following example demonstrates the use of the <b>Prepare</b> method.
- <code lang="Visual Basic">
- public sub PrepareExample()
- Dim cmd as New MySqlCommand("INSERT INTO mytable VALUES (?val)", myConnection)
- cmd.Parameters.Add( "?val", 10 )
- cmd.Prepare()
- cmd.ExecuteNonQuery()
-
- cmd.Parameters(0).Value = 20
- cmd.ExecuteNonQuery()
- end sub
- </code>
- <code lang="C#">
- private void PrepareExample()
- {
- MySqlCommand cmd = new MySqlCommand("INSERT INTO mytable VALUES (?val)", myConnection);
- cmd.Parameters.Add( "?val", 10 );
- cmd.Prepare();
- cmd.ExecuteNonQuery();
-
- cmd.Parameters[0].Value = 20;
- cmd.ExecuteNonQuery();
- }
- </code>
- </example>
-</Prepare>
+ <Prepare>
+ <summary>
+ Creates a prepared version of the command on an instance of MySQL Server.
+ </summary>
+ <remarks>
+ <para>
+ Prepared statements are only supported on MySQL version 4.1 and higher. Calling
+ prepare while connected to earlier versions of MySQL will succeed but will execute
+ the statement in the same way as unprepared.
+ </para>
+ </remarks>
+ <example>
+ The following example demonstrates the use of the <b>Prepare</b> method.
+ <code lang="VB.NET">
+ public sub PrepareExample()
+ Dim cmd as New MySqlCommand("INSERT INTO mytable VALUES (?val)", myConnection)
+ cmd.Parameters.Add( "?val", 10 )
+ cmd.Prepare()
+ cmd.ExecuteNonQuery()
-<ExecuteScalar>
- <summary>
- Executes the query, and returns the first column of the first row in the
- result set returned by the query. Extra columns or rows are ignored.
- </summary>
- <returns>
- The first column of the first row in the result set, or a null reference if the
- result set is empty
- </returns>
- <remarks>
- <para>Use the <B>ExecuteScalar</B> method to retrieve a single value (for example,
- an aggregate value) from a database. This requires less code than using the
- <see cref="ExecuteReader()"/> method, and then performing the operations necessary
- to generate the single value using the data returned by a <see cref="MySqlDataReader"/>
- </para>
- <para>A typical <B>ExecuteScalar</B> query can be formatted as in the following C#
- example:</para>
-<code lang="C#">
-cmd.CommandText = "select count(*) from region";
-Int32 count = (int32) cmd.ExecuteScalar();
-</code>
- </remarks>
- <example>
- The following example creates a <see cref="MySqlCommand"/> and then
- executes it using <B>ExecuteScalar</B>. The example is passed a string that is a
- SQL statement that returns an aggregate result, and a string to use to
- connect to the data source.
-
- <code lang="Visual Basic">
-Public Sub CreateMySqlCommand(myScalarQuery As String, myConnection As MySqlConnection)
- Dim myCommand As New MySqlCommand(myScalarQuery, myConnection)
- myCommand.Connection.Open()
- myCommand.ExecuteScalar()
- myConnection.Close()
-End Sub
-</code>
-<code lang="C#">
-public void CreateMySqlCommand(string myScalarQuery, MySqlConnection myConnection)
- {
- MySqlCommand myCommand = new MySqlCommand(myScalarQuery, myConnection);
- myCommand.Connection.Open();
- myCommand.ExecuteScalar();
- myConnection.Close();
- }
-</code>
-<code lang="C++">
-public:
- void CreateMySqlCommand(String* myScalarQuery, MySqlConnection* myConnection)
- {
+ cmd.Parameters(0).Value = 20
+ cmd.ExecuteNonQuery()
+ end sub
+ </code>
+ <code lang="C#">
+ private void PrepareExample()
+ {
+ MySqlCommand cmd = new MySqlCommand("INSERT INTO mytable VALUES (?val)", myConnection);
+ cmd.Parameters.Add( "?val", 10 );
+ cmd.Prepare();
+ cmd.ExecuteNonQuery();
+
+ cmd.Parameters[0].Value = 20;
+ cmd.ExecuteNonQuery();
+ }
+ </code>
+ </example>
+ </Prepare>
+
+ <ExecuteScalar>
+ <summary>
+ Executes the query, and returns the first column of the first row in the
+ result set returned by the query. Extra columns or rows are ignored.
+ </summary>
+ <returns>
+ The first column of the first row in the result set, or a null reference if the
+ result set is empty
+ </returns>
+ <remarks>
+ <para>
+ Use the <B>ExecuteScalar</B> method to retrieve a single value (for example,
+ an aggregate value) from a database. This requires less code than using the
+ <see cref="ExecuteReader()"/> method, and then performing the operations necessary
+ to generate the single value using the data returned by a <see cref="MySqlDataReader"/>
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlCommand"/> and then
+ executes it using <B>ExecuteScalar</B>. The example is passed a string that is a
+ SQL statement that returns an aggregate result, and a string to use to
+ connect to the data source.
+
+ <code lang="vbnet">
+ Public Sub CreateMySqlCommand(myScalarQuery As String, myConnection As MySqlConnection)
+ Dim myCommand As New MySqlCommand(myScalarQuery, myConnection)
+ myCommand.Connection.Open()
+ myCommand.ExecuteScalar()
+ myConnection.Close()
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlCommand(string myScalarQuery, MySqlConnection myConnection)
+ {
+ MySqlCommand myCommand = new MySqlCommand(myScalarQuery, myConnection);
+ myCommand.Connection.Open();
+ myCommand.ExecuteScalar();
+ myConnection.Close();
+ }
+ </code>
+ <code lang="C++">
+ public:
+ void CreateMySqlCommand(String* myScalarQuery, MySqlConnection* myConnection)
+ {
MySqlCommand* myCommand = new MySqlCommand(myScalarQuery, myConnection);
myCommand->Connection->Open();
myCommand->ExecuteScalar();
myConnection->Close();
- }
-</code>
-
- </example>
-</ExecuteScalar>
+ }
+ </code>
-<CommandText>
- <summary>
- Gets or sets the SQL statement to execute at the data source.
- </summary>
- <value>
- The SQL statement or stored procedure to execute. The default is an empty string.
- </value>
- <remarks>
- <para>
- When the <see cref="CommandType"/> property is set to <B>StoredProcedure</B>,
- the <B>CommandText</B> property should be set to the name of the stored procedure.
- The user may be required to use escape character syntax if the stored procedure name
- contains any special characters. The command executes this stored procedure when
- you call one of the Execute methods. Starting with Connector/Net 5.0, having both a stored function
- and stored procedure with the same name in the same database is not supported. It is
- suggested that you provide unqiue names for your stored routines.
- </para>
- </remarks>
- <example>
-The following example creates a <see cref="MySqlCommand"/> and sets some of its properties.
-<code lang="Visual Basic">
-Public Sub CreateMySqlCommand()
- Dim myCommand As New MySqlCommand()
- myCommand.CommandText = "SELECT * FROM Mytable ORDER BY id"
- myCommand.CommandType = CommandType.Text
-End Sub
-</code>
-<code lang="C#">
-public void CreateMySqlCommand()
- {
- MySqlCommand myCommand = new MySqlCommand();
- myCommand.CommandText = "SELECT * FROM mytable ORDER BY id";
- myCommand.CommandType = CommandType.Text;
- }
-</code>
- </example>
-</CommandText>
+ </example>
+ </ExecuteScalar>
-<CommandTimeout>
- <summary>
- Gets or sets the wait time before terminating the attempt to execute a command
-and generating an error.
- </summary>
- <value>
- The time (in seconds) to wait for the command to execute. The default is 30
-seconds.
- </value>
- <remarks>
- CommandTimeout is dependent on the ability of MySQL to cancel an executing query.
- Because of this, CommandTimeout is only supported when connected to MySQL
- version 5.0.0 or higher.
- </remarks>
-</CommandTimeout>
+ <CommandText>
+ <summary>
+ Gets or sets the SQL statement to execute at the data source.
+ </summary>
+ <value>
+ The SQL statement or stored procedure to execute. The default is an empty string.
+ </value>
+ <remarks>
+ <para>
+ When the <see cref="CommandType"/> property is set to <B>StoredProcedure</B>,
+ the <B>CommandText</B> property should be set to the name of the stored procedure.
+ The user may be required to use escape character syntax if the stored procedure name
+ contains any special characters. The command executes this stored procedure when
+ you call one of the Execute methods. Starting with Connector/Net 5.0, having both a stored function
+ and stored procedure with the same name in the same database is not supported. It is
+ suggested that you provide unqiue names for your stored routines.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlCommand"/> and sets some of its properties.
+ <code lang="vbnet">
+ Public Sub CreateMySqlCommand()
+ Dim myCommand As New MySqlCommand()
+ myCommand.CommandText = "SELECT * FROM Mytable ORDER BY id"
+ myCommand.CommandType = CommandType.Text
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlCommand()
+ {
+ MySqlCommand myCommand = new MySqlCommand();
+ myCommand.CommandText = "SELECT * FROM mytable ORDER BY id";
+ myCommand.CommandType = CommandType.Text;
+ }
+ </code>
+ </example>
+ </CommandText>
-<CommandType>
- <summary>Gets or sets a value indicating how the <see cref="CommandText"/> property is to be interpreted.
- </summary>
- <value>
- One of the <see cref="System.Data.CommandType"/> values. The default is <B>Text</B>.
- </value>
- <remarks>
- <para>
- When you set the <B>CommandType</B> property to <B>StoredProcedure</B>, you
- should set the <see cref="CommandText"/> property to the name of the stored
- procedure. The command executes this stored procedure when you call one of the
- Execute methods.
- </para>
- </remarks>
- <example>
-The following example creates a <see cref="MySqlCommand"/> and sets some of its properties.
-<code lang="Visual Basic">
-Public Sub CreateMySqlCommand()
- Dim myCommand As New MySqlCommand()
- myCommand.CommandType = CommandType.Text
-End Sub
-</code>
-<code lang="C#">
-public void CreateMySqlCommand()
-{
- MySqlCommand myCommand = new MySqlCommand();
- myCommand.CommandType = CommandType.Text;
-}
-</code>
-</example>
-</CommandType>
+ <CommandTimeout>
+ <summary>
+ Gets or sets the wait time before terminating the attempt to execute a command
+ and generating an error.
+ </summary>
+ <value>
+ The time (in seconds) to wait for the command to execute. The default is 30
+ seconds.
+ </value>
+ <remarks>
+ CommandTimeout is dependent on the ability of MySQL to cancel an executing query.
+ Because of this, CommandTimeout is only supported when connected to MySQL
+ version 5.0.0 or higher.
+ </remarks>
+ </CommandTimeout>
+ <CommandType>
+ <summary>
+ Gets or sets a value indicating how the <see cref="CommandText"/> property is to be interpreted.
+ </summary>
+ <value>
+ One of the <see cref="System.Data.CommandType"/> values. The default is <B>Text</B>.
+ </value>
+ <remarks>
+ <para>
+ When you set the <B>CommandType</B> property to <B>StoredProcedure</B>, you
+ should set the <see cref="CommandText"/> property to the name of the stored
+ procedure. The command executes this stored procedure when you call one of the
+ Execute methods.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlCommand"/> and sets some of its properties.
+ <code lang="vbnet">
+ Public Sub CreateMySqlCommand()
+ Dim myCommand As New MySqlCommand()
+ myCommand.CommandType = CommandType.Text
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlCommand()
+ {
+ MySqlCommand myCommand = new MySqlCommand();
+ myCommand.CommandType = CommandType.Text;
+ }
+ </code>
+ </example>
+ </CommandType>
-<Connection>
- <summary>
- Gets or sets the <see cref="MySqlConnection"/> used by this instance of the
- <see cref="MySqlCommand"/>.
- </summary>
- <value>
- The connection to a data source. The default value is a null reference
-(<B>Nothing</B> in Visual Basic).
- </value>
- <remarks>
- <para>
- If you set <B>Connection</B> while a transaction is in progress and the
- <see cref="Transaction"/> property is not null, an <see cref="InvalidOperationException"/>
- is generated. If the <B>Transaction</B> property is not null and the transaction
- has already been committed or rolled back, <B>Transaction</B> is set to
- null.
- </para>
- </remarks>
- <example>
-The following example creates a <see cref="MySqlCommand"/> and sets some of its properties.
-<code lang="Visual Basic">
-Public Sub CreateMySqlCommand()
- Dim mySelectQuery As String = "SELECT * FROM mytable ORDER BY id"
- Dim myConnectString As String = "Persist Security Info=False;database=test;server=myServer"
- Dim myCommand As New MySqlCommand(mySelectQuery)
- myCommand.Connection = New MySqlConnection(myConnectString)
- myCommand.CommandType = CommandType.Text
-End Sub
-</code>
-<code lang="C#">
-public void CreateMySqlCommand()
- {
- string mySelectQuery = "SELECT * FROM mytable ORDER BY id";
- string myConnectString = "Persist Security Info=False;database=test;server=myServer";
- MySqlCommand myCommand = new MySqlCommand(mySelectQuery);
- myCommand.Connection = new MySqlConnection(myConnectString);
- myCommand.CommandType = CommandType.Text;
- }
- </code>
- </example>
-</Connection>
-<IsPrepared>
-</IsPrepared>
+ <Connection>
+ <summary>
+ Gets or sets the <see cref="MySqlConnection"/> used by this instance of the
+ <see cref="MySqlCommand"/>.
+ </summary>
+ <value>
+ The connection to a data source. The default value is a null reference
+ (<B>Nothing</B> in Visual Basic).
+ </value>
+ <remarks>
+ <para>
+ If you set <B>Connection</B> while a transaction is in progress and the
+ <see cref="Transaction"/> property is not null, an <see cref="InvalidOperationException"/>
+ is generated. If the <B>Transaction</B> property is not null and the transaction
+ has already been committed or rolled back, <B>Transaction</B> is set to
+ null.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlCommand"/> and sets some of its properties.
+ <code lang="vbnet">
+ Public Sub CreateMySqlCommand()
+ Dim mySelectQuery As String = "SELECT * FROM mytable ORDER BY id"
+ Dim myConnectString As String = "Persist Security Info=False;database=test;server=myServer"
+ Dim myCommand As New MySqlCommand(mySelectQuery)
+ myCommand.Connection = New MySqlConnection(myConnectString)
+ myCommand.CommandType = CommandType.Text
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlCommand()
+ {
+ string mySelectQuery = "SELECT * FROM mytable ORDER BY id";
+ string myConnectString = "Persist Security Info=False;database=test;server=myServer";
+ MySqlCommand myCommand = new MySqlCommand(mySelectQuery);
+ myCommand.Connection = new MySqlConnection(myConnectString);
+ myCommand.CommandType = CommandType.Text;
+ }
+ </code>
+ </example>
+ </Connection>
+ <IsPrepared>
+ </IsPrepared>
+
<LastInsertedId>
<summary>Provides the id of the last inserted row.</summary>
<value>
@@ -710,96 +834,102 @@
An important point to remember is that this property can be used
in batch SQL scenarios but it's important to remember that it will
only reflect the insert id from the last insert statement in the batch.
-
+
This property can also be used when the batch includes select statements
and ExecuteReader is used. This property can be consulted during result set
processing.
</remarks>
</LastInsertedId>
-<Parameters>
- <summary>Get the <see cref="MySqlParameterCollection"/></summary>
- <value>The parameters of the SQL statement or stored procedure. The default is
-an empty collection.</value>
- <remarks>
- Connector/Net does not support unnamed parameters. Every parameter added to the collection must
- have an associated name.
- </remarks>
- <example>
-The following example creates a <see cref="MySqlCommand"/> and displays its parameters.
-To accomplish this, the method is passed a <see cref="MySqlConnection"/>, a query string
-that is a SQL SELECT statement, and an array of <see cref="MySqlParameter"/> objects.
-<code lang="Visual Basic">
-Public Sub CreateMySqlCommand(myConnection As MySqlConnection, _
-mySelectQuery As String, myParamArray() As MySqlParameter)
- Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
- myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=?age"
- myCommand.UpdatedRowSource = UpdateRowSource.Both
- myCommand.Parameters.Add(myParamArray)
- Dim j As Integer
- For j = 0 To myCommand.Parameters.Count - 1
- myCommand.Parameters.Add(myParamArray(j))
- Next j
- Dim myMessage As String = ""
- Dim i As Integer
- For i = 0 To myCommand.Parameters.Count - 1
+ <Parameters>
+ <summary>
+ Get the <see cref="MySqlParameterCollection"/>
+ </summary>
+ <value>
+ The parameters of the SQL statement or stored procedure. The default is
+ an empty collection.
+ </value>
+ <remarks>
+ Connector/Net does not support unnamed parameters. Every parameter added to the collection must
+ have an associated name.
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlCommand"/> and displays its parameters.
+ To accomplish this, the method is passed a <see cref="MySqlConnection"/>, a query string
+ that is a SQL SELECT statement, and an array of <see cref="MySqlParameter"/> objects.
+ <code lang="vbnet">
+ Public Sub CreateMySqlCommand(myConnection As MySqlConnection, _
+ mySelectQuery As String, myParamArray() As MySqlParameter)
+ Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
+ myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=?age"
+ myCommand.UpdatedRowSource = UpdateRowSource.Both
+ myCommand.Parameters.Add(myParamArray)
+ Dim j As Integer
+ For j = 0 To myCommand.Parameters.Count - 1
+ myCommand.Parameters.Add(myParamArray(j))
+ Next j
+ Dim myMessage As String = ""
+ Dim i As Integer
+ For i = 0 To myCommand.Parameters.Count - 1
myMessage += myCommand.Parameters(i).ToString() & ControlChars.Cr
- Next i
- Console.WriteLine(myMessage)
-End Sub
-</code>
-<code lang="C#">
-public void CreateMySqlCommand(MySqlConnection myConnection, string mySelectQuery,
- MySqlParameter[] myParamArray)
-{
- MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection);
- myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=?age";
- myCommand.Parameters.Add(myParamArray);
- for (int j=0; j<myParamArray.Length; j++)
- {
- myCommand.Parameters.Add(myParamArray[j]) ;
- }
- string myMessage = "";
- for (int i = 0; i < myCommand.Parameters.Count; i++)
- {
- myMessage += myCommand.Parameters[i].ToString() + "\n";
- }
- MessageBox.Show(myMessage);
-}
-</code>
-</example>
-</Parameters>
+ Next i
+ Console.WriteLine(myMessage)
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlCommand(MySqlConnection myConnection, string mySelectQuery,
+ MySqlParameter[] myParamArray)
+ {
+ MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection);
+ myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=?age";
+ myCommand.Parameters.Add(myParamArray);
+ for (int j=0; j<myParamArray.Length; j++)
+ {
+ myCommand.Parameters.Add(myParamArray[j]) ;
+ }
+ string myMessage = "";
+ for (int i = 0; i < myCommand.Parameters.Count; i++)
+ {
+ myMessage += myCommand.Parameters[i].ToString() + "\n";
+ }
+ MessageBox.Show(myMessage);
+ }
+ </code>
+ </example>
+ </Parameters>
-<Transaction>
- <summary>
- Gets or sets the <see cref="MySqlTransaction"/> within which the <see cref="MySqlCommand"/> executes.
- </summary>
- <value>
- The <see cref="MySqlTransaction"/>. The default value is a null reference (<B>Nothing</B> in Visual Basic).
- </value>
- <remarks>
- You cannot set the <B>Transaction</B> property if it is already set to a
- specific value, and the command is in the process of executing. If you set the
- transaction property to a <see cref="MySqlTransaction"/> object that is not connected
- to the same <see cref="MySqlConnection"/> as the <see cref="MySqlCommand"/> object,
- an exception will be thrown the next time you attempt to execute a statement.
- </remarks>
-</Transaction>
+ <Transaction>
+ <summary>
+ Gets or sets the <see cref="MySqlTransaction"/> within which the <see cref="MySqlCommand"/> executes.
+ </summary>
+ <value>
+ The <see cref="MySqlTransaction"/>. The default value is a null reference (<B>Nothing</B> in Visual Basic).
+ </value>
+ <remarks>
+ You cannot set the <B>Transaction</B> property if it is already set to a
+ specific value, and the command is in the process of executing. If you set the
+ transaction property to a <see cref="MySqlTransaction"/> object that is not connected
+ to the same <see cref="MySqlConnection"/> as the <see cref="MySqlCommand"/> object,
+ an exception will be thrown the next time you attempt to execute a statement.
+ </remarks>
+ </Transaction>
-<UpdatedRowSource>
- <summary>
- Gets or sets how command results are applied to the <see cref="DataRow"/>
- when used by the <see cref="System.Data.Common.DbDataAdapter.Update"/> method
- of the <see cref="System.Data.Common.DbDataAdapter"/>.
- </summary>
- <value>One of the <see cref="UpdateRowSource"/> values.</value>
- <remarks>
- <para>
- The default <see cref="System.Data.UpdateRowSource"/> value is
- <B>Both</B> unless the command is automatically generated (as in the case of the
- <see cref="MySqlCommandBuilder"/>), in which case the default is <B>None</B>.
- </para>
- </remarks>
-</UpdatedRowSource>
+ <UpdatedRowSource>
+ <summary>
+ Gets or sets how command results are applied to the <see cref="DataRow"/>
+ when used by the <see cref="System.Data.Common.DbDataAdapter.Update"/> method
+ of the <see cref="System.Data.Common.DbDataAdapter"/>.
+ </summary>
+ <value>
+ One of the <see cref="UpdateRowSource"/> values.
+ </value>
+ <remarks>
+ <para>
+ The default <see cref="System.Data.UpdateRowSource"/> value is
+ <B>Both</B> unless the command is automatically generated (as in the case of the
+ <see cref="MySqlCommandBuilder"/>), in which case the default is <B>None</B>.
+ </para>
+ </remarks>
+ </UpdatedRowSource>
</docs>
Modified: branches/5.1/Driver/Source/docs/MySqlCommandBuilder.xml
===================================================================
--- branches/5.1/Driver/Source/docs/MySqlCommandBuilder.xml 2007-11-01 20:58:53 UTC (rev 1054)
+++ branches/5.1/Driver/Source/docs/MySqlCommandBuilder.xml 2007-11-02 21:13:58 UTC (rev 1055)
@@ -1,308 +1,321 @@
<docs>
-<class>
- <summary>
- Automatically generates single-table commands used to reconcile changes made to a DataSet with the associated MySQL database. This class cannot be inherited.
- </summary>
- <remarks>
- <para>The <see cref="MySqlDataAdapter"/> does not automatically generate the SQL statements required to
- reconcile changes made to a <see cref="System.Data.DataSet">DataSet</see> with the associated instance of MySQL.
- However, you can create a <B>MySqlCommandBuilder</B> object to automatically generate SQL statements for
- single-table updates if you set the <see cref="MySqlDataAdapter.SelectCommand">SelectCommand</see> property
- of the <B>MySqlDataAdapter</B>. Then, any additional SQL statements that you do not set are generated by the
- <B>MySqlCommandBuilder</B>.</para>
+ <class>
+ <summary>
+ Automatically generates single-table commands used to reconcile changes made to a DataSet with the associated MySQL database. This class cannot be inherited.
+ </summary>
+ <remarks>
+ <para>
+ The <see cref="MySqlDataAdapter"/> does not automatically generate the SQL statements required to
+ reconcile changes made to a <see cref="System.Data.DataSet">DataSet</see> with the associated instance of MySQL.
+ However, you can create a <B>MySqlCommandBuilder</B> object to automatically generate SQL statements for
+ single-table updates if you set the <see cref="MySqlDataAdapter.SelectCommand">SelectCommand</see> property
+ of the <B>MySqlDataAdapter</B>. Then, any additional SQL statements that you do not set are generated by the
+ <B>MySqlCommandBuilder</B>.
+ </para>
- <para>The <B>MySqlCommandBuilder</B> registers itself as a listener for <see cref="MySqlDataAdapter.OnRowUpdating">RowUpdating</see>
- events whenever you set the <see cref="DataAdapter"/> property. You can only associate one
- <B>MySqlDataAdapter</B> or <B>MySqlCommandBuilder</B> object with each other at one time.</para>
+ <para>
+ The <B>MySqlCommandBuilder</B> registers itself as a listener for <see cref="MySqlDataAdapter.OnRowUpdating">RowUpdating</see>
+ events whenever you set the <see cref="DataAdapter"/> property. You can only associate one
+ <B>MySqlDataAdapter</B> or <B>MySqlCommandBuilder</B> object with each other at one time.
+ </para>
- <para>To generate INSERT, UPDATE, or DELETE statements, the <B>MySqlCommandBuilder</B> uses the
- <B>SelectCommand</B> property to retrieve a required set of metadata automatically. If you change
- the <B>SelectCommand</B> after the metadata has is retrieved (for example, after the first update), you
- should call the <see cref="RefreshSchema"/> method to update the metadata.</para>
+ <para>
+ To generate INSERT, UPDATE, or DELETE statements, the <B>MySqlCommandBuilder</B> uses the
+ <B>SelectCommand</B> property to retrieve a required set of metadata automatically. If you change
+ the <B>SelectCommand</B> after the metadata has is retrieved (for example, after the first update), you
+ should call the <see cref="RefreshSchema"/> method to update the metadata.
+ </para>
- <para>The <B>SelectCommand</B> must also return at least one primary key or unique
- column. If none are present, an <I>InvalidOperation</I> exception is generated,
- and the commands are not generated.</para>
+ <para>
+ The <B>SelectCommand</B> must also return at least one primary key or unique
+ column. If none are present, an <I>InvalidOperation</I> exception is generated,
+ and the commands are not generated.
+ </para>
- <para>The <B>MySqlCommandBuilder</B> also uses the <see cref="MySqlCommand.Connection">Connection</see>,
- <see cref="MySqlCommand.CommandTimeout">CommandTimeout</see>, and <see cref="MySqlCommand.Transaction">Transaction</see>
- properties referenced by the <B>SelectCommand</B>. The user should call
- <B>RefreshSchema</B> if any of these properties are modified, or if the
- <B>SelectCommand</B> itself is replaced. Otherwise the <see cref="MySqlDataAdapter.InsertCommand">InsertCommand</see>,
- <see cref="MySqlDataAdapter.UpdateCommand">UpdateCommand</see>, and
- <see cref="MySqlDataAdapter.DeleteCommand">DeleteCommand</see> properties retain
- their previous values.</para>
+ <para>
+ The <B>MySqlCommandBuilder</B> also uses the <see cref="MySqlCommand.Connection">Connection</see>,
+ <see cref="MySqlCommand.CommandTimeout">CommandTimeout</see>, and <see cref="MySqlCommand.Transaction">Transaction</see>
+ properties referenced by the <B>SelectCommand</B>. The user should call
+ <B>RefreshSchema</B> if any of these properties are modified, or if the
+ <B>SelectCommand</B> itself is replaced. Otherwise the <see cref="MySqlDataAdapter.InsertCommand">InsertCommand</see>,
+ <see cref="MySqlDataAdapter.UpdateCommand">UpdateCommand</see>, and
+ <see cref="MySqlDataAdapter.DeleteCommand">DeleteCommand</see> properties retain
+ their previous values.
+ </para>
- <para>If you call <i>Dispose</i>, the <B>MySqlCommandBuilder</B> is disassociated
- from the <B>MySqlDataAdapter</B>, and the generated commands are no longer used.
- </para>
-
- <note>
- Caution must be used when using MySqlCOmmandBuilder on MySql 4.0 systems. With MySql 4.0,
- database/schema information is not provided to the connector for a query. This means that
- a query that pulls columns from two identically named tables in two or more different databases
- will not cause an exception to be thrown but will not work correctly. Even more dangerous
- is the situation where your select statement references database X but is executed in
- database Y and both databases have tables with similar layouts. This situation can cause
- unwanted changes or deletes.
- This note does not apply to MySQL versions 4.1 and later.
- </note>
-
- </remarks>
+ <para>
+ If you call <i>Dispose</i>, the <B>MySqlCommandBuilder</B> is disassociated
+ from the <B>MySqlDataAdapter</B>, and the generated commands are no longer used.
+ </para>
- <example>
- The following example uses the <see cref="MySqlCommand"/>, along
- <see cref="MySqlDataAdapter"/> and <see cref="MySqlConnection"/>, to
- select rows from a data source. The example is passed an initialized
- <see cref="System.Data.DataSet"/>, a connection string, a
- query string that is a SQL SELECT statement, and a string that is the
- name of the database table. The example then creates a <B>MySqlCommandBuilder</B>.
-
- <code lang="Visual Basic">
- Public Shared Function SelectRows(myConnection As String, mySelectQuery As String, myTableName As String) As DataSet
- Dim myConn As New MySqlConnection(myConnection)
- Dim myDataAdapter As New MySqlDataAdapter()
- myDataAdapter.SelectCommand = New MySqlCommand(mySelectQuery, myConn)
- Dim cb As SqlCommandBuilder = New MySqlCommandBuilder(myDataAdapter)
+ <note>
+ Caution must be used when using MySqlCOmmandBuilder on MySql 4.0 systems. With MySql 4.0,
+ database/schema information is not provided to the connector for a query. This means that
+ a query that pulls columns from two identically named tables in two or more different databases
+ will not cause an exception to be thrown but will not work correctly. Even more dangerous
+ is the situation where your select statement references database X but is executed in
+ database Y and both databases have tables with similar layouts. This situation can cause
+ unwanted changes or deletes.
+ This note does not apply to MySQL versions 4.1 and later.
+ </note>
- myConn.Open()
+ </remarks>
- Dim ds As DataSet = New DataSet
- myDataAdapter.Fill(ds, myTableName)
+ <example>
+ The following example uses the <see cref="MySqlCommand"/>, along
+ <see cref="MySqlDataAdapter"/> and <see cref="MySqlConnection"/>, to
+ select rows from a data source. The example is passed an initialized
+ <see cref="System.Data.DataSet"/>, a connection string, a
+ query string that is a SQL SELECT statement, and a string that is the
+ name of the database table. The example then creates a <B>MySqlCommandBuilder</B>.
- ' Code to modify data in DataSet here
+ <code lang="vbnet">
+ Public Shared Function SelectRows(myConnection As String, mySelectQuery As String, myTableName As String) As DataSet
+ Dim myConn As New MySqlConnection(myConnection)
+ Dim myDataAdapter As New MySqlDataAdapter()
+ myDataAdapter.SelectCommand = New MySqlCommand(mySelectQuery, myConn)
+ Dim cb As SqlCommandBuilder = New MySqlCommandBuilder(myDataAdapter)
- ' Without the MySqlCommandBuilder this line would fail.
- myDataAdapter.Update(ds, myTableName)
+ myConn.Open()
- myConn.Close()
- End Function 'SelectRows
- </code>
- <code lang="C#">
- public static DataSet SelectRows(string myConnection, string mySelectQuery, string myTableName)
- {
- MySqlConnection myConn = new MySqlConnection(myConnection);
- MySqlDataAdapter myDataAdapter = new MySqlDataAdapter();
- myDataAdapter.SelectCommand = new MySqlCommand(mySelectQuery, myConn);
- MySqlCommandBuilder cb = new MySqlCommandBuilder(myDataAdapter);
+ Dim ds As DataSet = New DataSet
+ myDataAdapter.Fill(ds, myTableName)
- myConn.Open();
+ ' Code to modify data in DataSet here
- DataSet ds = new DataSet();
- myDataAdapter.Fill(ds, myTableName);
+ ' Without the MySqlCommandBuilder this line would fail.
+ myDataAdapter.Update(ds, myTableName)
- //code to modify data in DataSet here
+ myConn.Close()
+ End Function 'SelectRows
+ </code>
+ <code lang="C#">
+ public static DataSet SelectRows(string myConnection, string mySelectQuery, string myTableName)
+ {
+ MySqlConnection myConn = new MySqlConnection(myConnection);
+ MySqlDataAdapter myDataAdapter = new MySqlDataAdapter();
+ myDataAdapter.SelectCommand = new MySqlCommand(mySelectQuery, myConn);
+ MySqlCommandBuilder cb = new MySqlCommandBuilder(myDataAdapter);
- //Without the MySqlCommandBuilder this line would fail
- myDataAdapter.Update(ds, myTableName);
+ myConn.Open();
- myConn.Close();
+ DataSet ds = new DataSet();
+ myDataAdapter.Fill(ds, myTableName);
- return ds;
- }
+ //code to modify data in DataSet here
- </code>
- </example>
-</class>
+ //Without the MySqlCommandBuilder this line would fail
+ myDataAdapter.Update(ds, myTableName);
-<Ctor>
- <summary>
- Initializes a new instance of the <see cref="MySqlCommandBuilder"/> class.
- </summary>
-</Ctor>
+ myConn.Close();
-<Ctor2>
- <summary>
- Initializes a new instance of the <see cref="MySqlCommandBuilder"/> class
- with the associated <see cref="MySqlDataAdapter"/> object.
- </summary>
- <param name="adapter">The <see cref="MySqlDataAdapter"/> to use.</param>
- <remarks>
- <para>
- The <see cref="MySqlCommandBuilder"/> registers itself as a listener for
- <see cref="MySqlDataAdapter.RowUpdating"/> events that are generated by the
- <see cref="MySqlDataAdapter"/> specified in this property.
- </para>
- <para>
- When you create a new instance <B>MySqlCommandBuilder</B>, any existing
- <B>MySqlCommandBuilder</B> associated with this <B>MySqlDataAdapter</B>
- is released.
- </para>
- </remarks>
-</Ctor2>
+ return ds;
+ }
+ </code>
+ </example>
+ </class>
-<DataAdapter>
- <summary>
- Gets or sets a <see cref="MySqlDataAdapter"/> object for which SQL statements are automatically generated.
- </summary>
- <value>
- A <see cref="MySqlDataAdapter"/> object.
- </value>
- <remarks>
- <para>
- The <see cref="MySqlCommandBuilder"/> registers itself as a listener for
- <see cref="MySqlDataAdapter.RowUpdating"/> events that are generated by the
- <see cref="MySqlDataAdapter"/> specified in this property.
- </para>
- <para>
- When you create a new instance <B>MySqlCommandBuilder</B>, any existing
- <B>MySqlCommandBuilder</B> associated with this <B>MySqlDataAdapter</B>
- is released.
- </para>
- </remarks>
-</DataAdapter>
+ <Ctor>
+ <summary>
+ Initializes a new instance of the <see cref="MySqlCommandBuilder"/> class.
+ </summary>
+ </Ctor>
-<QuotePrefix>
- <summary>
- Gets or sets the beginning character or characters to use when specifying MySQL
- database objects (for example, tables or columns) whose names contain
- characters such as spaces or reserved tokens.
- </summary>
- <value>
- The beginning character or characters to use. The default value is `.
- </value>
- <remarks>
- Database objects in MySQL can contain special characters such as spaces that would
- make normal SQL strings impossible to correctly parse. Use of the <b>QuotePrefix</b>
- and the <see cref="QuoteSuffix"/> properties allows the <see cref="MySqlCommandBuilder"/>
- to build SQL commands that handle this situation.
- </remarks>
-</QuotePrefix>
+ <Ctor2>
+ <summary>
+ Initializes a new instance of the <see cref="MySqlCommandBuilder"/> class
+ with the associated <see cref="MySqlDataAdapter"/> object.
+ </summary>
+ <param name="adapter">
+ The <see cref="MySqlDataAdapter"/> to use.
+ </param>
+ <remarks>
+ <para>
+ The <see cref="MySqlCommandBuilder"/> registers itself as a listener for
+ <see cref="MySqlDataAdapter.RowUpdating"/> events that are generated by the
+ <see cref="MySqlDataAdapter"/> specified in this property.
+ </para>
+ <para>
+ When you create a new instance <B>MySqlCommandBuilder</B>, any existing
+ <B>MySqlCommandBuilder</B> associated with this <B>MySqlDataAdapter</B>
+ is released.
+ </para>
+ </remarks>
+ </Ctor2>
-<QuoteSuffix>
- <summary>
- Gets or sets the beginning character or characters to use when specifying MySQL
- database objects (for example, tables or columns) whose names contain
- characters such as spaces or reserved tokens.
- </summary>
- <value>
- The beginning character or characters to use. The default value is `.
- </value>
- <remarks>
- Database objects in MySQL can contain special characters such as spaces that would
- make normal SQL strings impossible to correctly parse. Use of the <see cref="QuotePrefix"/>
- and the <b>QuoteSuffix</b> properties allows the <see cref="MySqlCommandBuilder"/>
- to build SQL commands that handle this situation.
- </remarks>
-</QuoteSuffix>
-<DeriveParameters>
- <summary>
-
- </summary>
- <remarks>
- </remarks>
-</DeriveParameters>
+ <DataAdapter>
+ <summary>
+ Gets or sets a <see cref="MySqlDataAdapter"/> object for which SQL statements are automatically generated.
+ </summary>
+ <value>
+ A <see cref="MySqlDataAdapter"/> object.
+ </value>
+ <remarks>
+ <para>
+ The <see cref="MySqlCommandBuilder"/> registers itself as a listener for
+ <see cref="MySqlDataAdapter.RowUpdating"/> events that are generated by the
+ <see cref="MySqlDataAdapter"/> specified in this property.
+ </para>
+ <para>
+ When you create a new instance <B>MySqlCommandBuilder</B>, any existing
+ <B>MySqlCommandBuilder</B> associated with this <B>MySqlDataAdapter</B>
+ is released.
+ </para>
+ </remarks>
+ </DataAdapter>
-<GetDeleteCommand>
- <summary>
- Gets the automatically generated <see cref="MySqlCommand"/> object
- required to perform deletions on the database.
- </summary>
- <returns>
- The <see cref="MySqlCommand"/> object generated to handle delete operations.
- </returns>
- <remarks>
- <para>
- An application can use the <B>GetDeleteCommand</B> method for informational
- or troubleshooting purposes because it returns the <see cref="MySqlCommand"/>
- object to be executed.
- </para>
- <para>
- You can also use <B>GetDeleteCommand</B> as the basis of a modified command.
- For example, you might call <B>GetDeleteCommand</B> and modify the
- <see cref="MySqlCommand.CommandTimeout"/> value, and then explicitly set that on the
- <see cref="MySqlDataAdapter"/>.
- </para>
- <para>
- After the SQL statement is first generated, the application must explicitly
- call <see cref="RefreshSchema"/> if it changes the statement in any way.
- Otherwise, the <B>GetDeleteCommand</B> will be still be using information
- from the previous statement, which might not be correct. The SQL statements
- are first generated either when the application calls
- <see cref="System.Data.Common.DataAdapter.Update"/> or <B>GetDeleteCommand</B>.
- </para>
- </remarks>
-</GetDeleteCommand>
+ <QuotePrefix>
+ <summary>
+ Gets or sets the beginning character or characters to use when specifying MySQL
+ database objects (for example, tables or columns) whose names contain
+ characters such as spaces or reserved tokens.
+ </summary>
+ <value>
+ The beginning character or characters to use. The default value is `.
+ </value>
+ <remarks>
+ Database objects in MySQL can contain special characters such as spaces that would
+ make normal SQL strings impossible to correctly parse. Use of the <b>QuotePrefix</b>
+ and the <see cref="QuoteSuffix"/> properties allows the <see cref="MySqlCommandBuilder"/>
+ to build SQL commands that handle this situation.
+ </remarks>
+ </QuotePrefix>
-<GetInsertCommand>
- <summary>
- Gets the automatically generated <see cref="MySqlCommand"/> object
- required to perform insertions on the database.
- </summary>
- <returns>
- The <see cref="MySqlCommand"/> object generated to handle insert operations.
- </returns>
- <remarks>
- <para>
- An application can use the <B>GetInsertCommand</B> method for informational
- or troubleshooting purposes because it returns the <see cref="MySqlCommand"/>
- object to be executed.
- </para>
- <para>
- You can also use the <B>GetInsertCommand</B> as the basis of a modified command.
- For example, you might call <B>GetInsertCommand</B> and modify the
- <see cref="MySqlCommand.CommandTimeout"/> value, and then explicitly set that on the
- <see cref="MySqlDataAdapter"/>.
- </para>
- <para>
- After the SQL statement is first generated, the application must explicitly
- call <see cref="RefreshSchema"/> if it changes the statement in any way.
- Otherwise, the <B>GetInsertCommand</B> will be still be using information
- from the previous statement, which might not be correct. The SQL statements
- are first generated either when the application calls
- <see cref="System.Data.Common.DataAdapter.Update"/> or <B>GetInsertCommand</B>.
- </para>
- </remarks>
-</GetInsertCommand>
+ <QuoteSuffix>
+ <summary>
+ Gets or sets the beginning character or characters to use when specifying MySQL
+ database objects (for example, tables or columns) whose names contain
+ characters such as spaces or reserved tokens.
+ </summary>
+ <value>
+ The beginning character or characters to use. The default value is `.
+ </value>
+ <remarks>
+ Database objects in MySQL can contain special characters such as spaces that would
+ make normal SQL strings impossible to correctly parse. Use of the <see cref="QuotePrefix"/>
+ and the <b>QuoteSuffix</b> properties allows the <see cref="MySqlCommandBuilder"/>
+ to build SQL commands that handle this situation.
+ </remarks>
+ </QuoteSuffix>
-<GetUpdateCommand>
- <summary>
- Gets the automatically generated <see cref="MySqlCommand"/> object
- required to perform updates on the database.
- </summary>
- <returns>
- The <see cref="MySqlCommand"/> object generated to handle update operations.
- </returns>
- <remarks>
- <para>
- An application can use the <B>GetUpdateCommand</B> method for informational
- or troubleshooting purposes because it returns the <see cref="MySqlCommand"/>
- object to be executed.
- </para>
- <para>
- You can also use <B>GetUpdateCommand</B> as the basis of a modified command.
- For example, you might call <B>GetUpdateCommand</B> and modify the
- <see cref="MySqlCommand.CommandTimeout"/> value, and then explicitly set that on the
- <see cref="MySqlDataAdapter"/>.
- </para>
- <para>
- After the SQL statement is first generated, the application must explicitly
- call <see cref="RefreshSchema"/> if it changes the statement in any way.
- Otherwise, the <B>GetUpdateCommand</B> will be still be using information
- from the previous statement, which might not be correct. The SQL statements
- are first generated either when the application calls
- <see cref="System.Data.Common.DataAdapter.Update"/> or <B>GetUpdateCommand</B>.
- </para>
- </remarks>
-</GetUpdateCommand>
+ <DeriveParameters>
+ <summary>
-<RefreshSchema>
- <summary>
- Refreshes the database schema information used to generate INSERT, UPDATE, or
- DELETE statements.
- </summary>
- <remarks>
- <para>
- An application should call <B>RefreshSchema</B> whenever the SELECT statement
- associated with the <see cref="MySqlCommandBuilder"/> changes.
- </para>
- <para>
- An application should call <B>RefreshSchema</B> whenever the
- <see cref="MySqlDataAdapter.SelectCommand"/> value of the <see cref="MySqlDataAdapter"/> changes.
- </para>
- </remarks>
-</RefreshSchema>
+ </summary>
+ <remarks>
+ </remarks>
+ </DeriveParameters>
+ <GetDeleteCommand>
+ <summary>
+ Gets the automatically generated <see cref="MySqlCommand"/> object
+ required to perform deletions on the database.
+ </summary>
+ <returns>
+ The <see cref="MySqlCommand"/> object generated to handle delete operations.
+ </returns>
+ <remarks>
+ <para>
+ An application can use the <B>GetDeleteCommand</B> method for informational
+ or troubleshooting purposes because it returns the <see cref="MySqlCommand"/>
+ object to be executed.
+ </para>
+ <para>
+ You can also use <B>GetDeleteCommand</B> as the basis of a modified command.
+ For example, you might call <B>GetDeleteCommand</B> and modify the
+ <see cref="MySqlCommand.CommandTimeout"/> value, and then explicitly set that on the
+ <see cref="MySqlDataAdapter"/>.
+ </para>
+ <para>
+ After the SQL statement is first generated, the application must explicitly
+ call <see cref="RefreshSchema"/> if it changes the statement in any way.
+ Otherwise, the <B>GetDeleteCommand</B> will be still be using information
+ from the previous statement, which might not be correct. The SQL statements
+ are first generated either when the application calls
+ <see cref="System.Data.Common.DataAdapter.Update"/> or <B>GetDeleteCommand</B>.
+ </para>
+ </remarks>
+ </GetDeleteCommand>
+
+ <GetInsertCommand>
+ <summary>
+ Gets the automatically generated <see cref="MySqlCommand"/> object
+ required to perform insertions on the database.
+ </summary>
+ <returns>
+ The <see cref="MySqlCommand"/> object generated to handle insert operations.
+ </returns>
+ <remarks>
+ <para>
+ An application can use the <B>GetInsertCommand</B> method for informational
+ or troubleshooting purposes because it returns the <see cref="MySqlCommand"/>
+ object to be executed.
+ </para>
+ <para>
+ You can also use the <B>GetInsertCommand</B> as the basis of a modified command.
+ For example, you might call <B>GetInsertCommand</B> and modify the
+ <see cref="MySqlCommand.CommandTimeout"/> value, and then explicitly set that on the
+ <see cref="MySqlDataAdapter"/>.
+ </para>
+ <para>
+ After the SQL statement is first generated, the application must explicitly
+ call <see cref="RefreshSchema"/> if it changes the statement in any way.
+ Otherwise, the <B>GetInsertCommand</B> will be still be using information
+ from the previous statement, which might not be correct. The SQL statements
+ are first generated either when the application calls
+ <see cref="System.Data.Common.DataAdapter.Update"/> or <B>GetInsertCommand</B>.
+ </para>
+ </remarks>
+ </GetInsertCommand>
+
+ <GetUpdateCommand>
+ <summary>
+ Gets the automatically generated <see cref="MySqlCommand"/> object
+ required to perform updates on the database.
+ </summary>
+ <returns>
+ The <see cref="MySqlCommand"/> object generated to handle update operations.
+ </returns>
+ <remarks>
+ <para>
+ An application can use the <B>GetUpdateCommand</B> method for informational
+ or troubleshooting purposes because it returns the <see cref="MySqlCommand"/>
+ object to be executed.
+ </para>
+ <para>
+ You can also use <B>GetUpdateCommand</B> as the basis of a modified command.
+ For example, you might call <B>GetUpdateCommand</B> and modify the
+ <see cref="MySqlCommand.CommandTimeout"/> value, and then explicitly set that on the
+ <see cref="MySqlDataAdapter"/>.
+ </para>
+ <para>
+ After the SQL statement is first generated, the application must explicitly
+ call <see cref="RefreshSchema"/> if it changes the statement in any way.
+ Otherwise, the <B>GetUpdateCommand</B> will be still be using information
+ from the previous statement, which might not be correct. The SQL statements
+ are first generated either when the application calls
+ <see cref="System.Data.Common.DataAdapter.Update"/> or <B>GetUpdateCommand</B>.
+ </para>
+ </remarks>
+ </GetUpdateCommand>
+
+ <RefreshSchema>
+ <summary>
+ Refreshes the database schema information used to generate INSERT, UPDATE, or
+ DELETE statements.
+ </summary>
+ <remarks>
+ <para>
+ An application should call <B>RefreshSchema</B> whenever the SELECT statement
+ associated with the <see cref="MySqlCommandBuilder"/> changes.
+ </para>
+ <para>
+ An application should call <B>RefreshSchema</B> whenever the
+ <see cref="MySqlDataAdapter.SelectCommand"/> value of the <see cref="MySqlDataAdapter"/> changes.
+ </para>
+ </remarks>
+ </RefreshSchema>
+
</docs>
\ No newline at end of file
Modified: branches/5.1/Driver/Source/docs/MySqlConnection.xml
===================================================================
--- branches/5.1/Driver/Source/docs/MySqlConnection.xml 2007-11-01 20:58:53 UTC (rev 1054)
+++ branches/5.1/Driver/Source/docs/MySqlConnection.xml 2007-11-02 21:13:58 UTC (rev 1055)
@@ -1,1015 +1,1191 @@
<docs>
-<DefaultCtor>
- <summary>Initializes a new instance of the <see cref="MySqlConnection"/> class.</summary>
- <remarks>
- When a new instance of <see cref="MySqlConnection"/> is created, the read/write
- properties are set to the following initial values unless they are specifically
- set using their associated keywords in the <see cref="ConnectionString"/> property.
- <para/>
- <list type="table">
- <listheader><term>Properties</term><term>Initial Value</term></listheader>
- <item><term><see cref="ConnectionString"/></term><term>empty string ("")</term></item>
- <item><term><see cref="ConnectionTimeout"/></term><term>15</term></item>
- <item><term><see cref="Database"/></term><term>empty string ("")</term></item>
- <item><term><see cref="DataSource"/></term><term>empty string ("")</term></item>
- <item><term><see cref="ServerVersion"/></term><term>empty string ("")</term></item>
- </list>
- <para/>
- You can change the value for these properties only by using the <B>ConnectionString</B> property.
- </remarks>
- <example>
- </example>
- <overloads>
- <summary>Initializes a new instance of the <see cref="MySqlConnection"/> class.</summary>
- </overloads>
-</DefaultCtor>
+ <DefaultCtor>
+ <summary>
+ Initializes a new instance of the <see cref="MySqlConnection"/> class.
+ </summary>
+ <remarks>
+ When a new instance of <see cref="MySqlConnection"/> is created, the read/write
+ properties are set to the following initial values unless they are specifically
+ set using their associated keywords in the <see cref="ConnectionString"/> property.
+ <para/>
+ <list type="table">
+ <listheader>
+ <term>Properties</term>
+ <term>Initial Value</term>
+ </listheader>
+ <item>
+ <term>
+ <see cref="ConnectionString"/>
+ </term>
+ <term>empty string ("")</term>
+ </item>
+ <item>
+ <term>
+ <see cref="ConnectionTimeout"/>
+ </term>
+ <term>15</term>
+ </item>
+ <item>
+ <term>
+ <see cref="Database"/>
+ </term>
+ <term>empty string ("")</term>
+ </item>
+ <item>
+ <term>
+ <see cref="DataSource"/>
+ </term>
+ <term>empty string ("")</term>
+ </item>
+ <item>
+ <term>
+ <see cref="ServerVersion"/>
+ </term>
+ <term>empty string ("")</term>
+ </item>
+ </list>
+ <para/>
+ You can change the value for these properties only by using the <B>ConnectionString</B> property.
+ </remarks>
+ <example>
+ </example>
+ <overloads>
+ <summary>
+ Initializes a new instance of the <see cref="MySqlConnection"/> class.
+ </summary>
+ </overloads>
+ </DefaultCtor>
-<Ctor1>
- <summary>Initializes a new instance of the <see cref="MySqlConnection"/> class when given a string containing the connection string.</summary>
- <remarks>
- When a new instance of <see cref="MySqlConnection"/> is created, the read/write
- properties are set to the following initial values unless they are specifically
- set using their associated keywords in the <see cref="ConnectionString"/> property.
- <para/>
- <list type="table">
- <listheader><term>Properties</term><term>Initial Value</term></listheader>
- <item><term><see cref="ConnectionString"/></term><term>empty string ("")</term></item>
- <item><term><see cref="ConnectionTimeout"/></term><term>15</term></item>
- <item><term><see cref="Database"/></term><term>empty string ("")</term></item>
- <item><term><see cref="DataSource"/></term><term>empty string ("")</term></item>
- <item><term><see cref="ServerVersion"/></term><term>empty string ("")</term></item>
- </list>
- <para/>
- You can change the value for these properties only by using the <B>ConnectionString</B> property.
- </remarks>
- <example>
- </example>
- <param name="connectionString">The connection properties used to open the MySQL database. </param>
-</Ctor1>
+ <Ctor1>
+ <summary>
+ Initializes a new instance of the <see cref="MySqlConnection"/> class when given a string containing the connection string.
+ </summary>
+ <remarks>
+ When a new instance of <see cref="MySqlConnection"/> is created, the read/write
+ properties are set to the following initial values unless they are specifically
+ set using their associated keywords in the <see cref="ConnectionString"/> property.
+ <para/>
+ <list type="table">
+ <listheader>
+ <term>Properties</term>
+ <term>Initial Value</term>
+ </listheader>
+ <item>
+ <term>
+ <see cref="ConnectionString"/>
+ </term>
+ <term>empty string ("")</term>
+ </item>
+ <item>
+ <term>
+ <see cref="ConnectionTimeout"/>
+ </term>
+ <term>15</term>
+ </item>
+ <item>
+ <term>
+ <see cref="Database"/>
+ </term>
+ <term>empty string ("")</term>
+ </item>
+ <item>
+ <term>
+ <see cref="DataSource"/>
+ </term>
+ <term>empty string ("")</term>
+ </item>
+ <item>
+ <term>
+ <see cref="ServerVersion"/>
+ </term>
+ <term>empty string ("")</term>
+ </item>
+ </list>
+ <para/>
+ You can change the value for these properties only by using the <B>ConnectionString</B> property.
+ </remarks>
+ <example>
+ </example>
+ <param name="connectionString">The connection properties used to open the MySQL database. </param>
+ </Ctor1>
-<Open>
- <summary>Opens a database connection with the property settings specified by the ConnectionString.</summary>
- <exception cref="InvalidOperationException">Cannot open a connection without specifying a data source or server.</exception>
- <exception cref="MySqlException">A connection-level error occurred while opening the connection.</exception>
- <remarks>
- <para>The <see cref="MySqlConnection"/> draws an open connection from the connection pool if one is available.
- Otherwise, it establishes a new connection to an instance of MySQL.</para>
- </remarks>
- <example>
- The following example creates a <see cref="MySqlConnection"/>, opens it,
- displays some of its properties, then closes the connection.
-
- <code lang="Visual Basic">
-Public Sub CreateMySqlConnection(myConnString As String)
- Dim myConnection As New MySqlConnection(myConnString)
- myConnection.Open()
- MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
- + ControlChars.Cr + "State: " + myConnection.State.ToString())
- myConnection.Close()
-End Sub
- </code>
- <code lang="C#">
-public void CreateMySqlConnection(string myConnString)
-{
- MySqlConnection myConnection = new MySqlConnection(myConnString);
- myConnection.Open();
- MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
- "\nState: " + myConnection.State.ToString());
- myConnection.Close();
-}
- </code>
- </example>
-</Open>
+ <Open>
+ <summary>Opens a database connection with the property settings specified by the ConnectionString.</summary>
+ <exception cref="InvalidOperationException">Cannot open a connection without specifying a data source or server.</exception>
+ <exception cref="MySqlException">A connection-level error occurred while opening the connection.</exception>
+ <remarks>
+ <para>
+ The <see cref="MySqlConnection"/> draws an open connection from the connection pool if one is available.
+ Otherwise, it establishes a new connection to an instance of MySQL.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlConnection"/>, opens it,
+ displays some of its properties, then closes the connection.
-<Database>
- <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>
- <para>The <B>Database</B> property does not update dynamically.
- If you change the current database using a SQL statement, then this property
- may reflect the wrong value. If you change the current database using the <see cref="ChangeDatabase"/>
- method, this property is updated to reflect the new database.</para>
- </remarks>
- <example>
- The following example creates a <see cref="MySqlConnection"/> and displays
- some of its read-only properties.
-
- <code lang="Visual Basic">
-Public Sub CreateMySqlConnection()
- Dim myConnString As String = _
- "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass"
- Dim myConnection As New MySqlConnection( myConnString )
- myConnection.Open()
- MessageBox.Show( "Server Version: " + myConnection.ServerVersion _
- + ControlChars.NewLine + "Database: " + myConnection.Database )
- myConnection.ChangeDatabase( "test2" )
- MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion _
- + ControlChars.NewLine + "Database: " + myConnection.Database )
- myConnection.Close()
-End Sub
- </code>
-
- <code lang="C#">
-public void CreateMySqlConnection()
-{
- string myConnString =
- "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass";
- MySqlConnection myConnection = new MySqlConnection( myConnString );
- myConnection.Open();
- MessageBox.Show( "Server Version: " + myConnection.ServerVersion
- + "\nDatabase: " + myConnection.Database );
- myConnection.ChangeDatabase( "test2" );
- MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion
- + "\nDatabase: " + myConnection.Database );
- myConnection.Close();
-}
- </code>
- </example>
-</Database>
+ <code lang="vbnet">
+ Public Sub CreateMySqlConnection(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ + ControlChars.Cr + "State: " + myConnection.State.ToString())
+ myConnection.Close()
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlConnection(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
+ "\nState: " + myConnection.State.ToString());
+ myConnection.Close();
+ }
+ </code>
+ </example>
+ </Open>
-<State>
- <summary>Gets the current state of the connection.</summary>
- <returns>A bitwise combination of the <see cref="System.Data.ConnectionState"/> values. The default is <B>Closed</B>.</returns>
- <remarks>
- The allowed state changes are:
- <list type="bullet">
- <item>From <B>Closed</B> to <B>Open</B>, using the <B>Open</B> method of the connection object.</item>
- <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>
- </list>
- </remarks>
- <example>
- The following example creates a <see cref="MySqlConnection"/>, opens it,
- displays some of its properties, then closes the connection.
-
- <code lang="Visual Basic">
-Public Sub CreateMySqlConnection(myConnString As String)
- Dim myConnection As New MySqlConnection(myConnString)
- myConnection.Open()
- MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
- + ControlChars.Cr + "State: " + myConnection.State.ToString())
- myConnection.Close()
-End Sub
- </code>
- <code lang="C#">
-public void CreateMySqlConnection(string myConnString)
-{
- MySqlConnection myConnection = new MySqlConnection(myConnString);
- myConnection.Open();
- MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
- "\nState: " + myConnection.State.ToString());
- myConnection.Close();
-}
- </code>
- </example>
-</State>
+ <Database>
+ <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>
+ <para>
+ The <B>Database</B> property does not update dynamically.
+ If you change the current database using a SQL statement, then this property
+ may reflect the wrong value. If you change the current database using the <see cref="ChangeDatabase"/>
+ method, this property is updated to reflect the new database.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlConnection"/> and displays
+ some of its read-only properties.
-<ServerVersion>
- <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="InvalidOperationException">The connection is closed.</exception>
- <example>
- The following example creates a <see cref="MySqlConnection"/>, opens it,
- displays some of its properties, then closes the connection.
-
- <code lang="Visual Basic">
-Public Sub CreateMySqlConnection(myConnString As String)
- Dim myConnection As New MySqlConnection(myConnString)
- myConnection.Open()
- MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
- + ControlChars.Cr + "State: " + myConnection.State.ToString())
- myConnection.Close()
-End Sub
- </code>
- <code lang="C#">
-public void CreateMySqlConnection(string myConnString)
-{
- MySqlConnection myConnection = new MySqlConnection(myConnString);
- myConnection.Open();
- MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
- "\nState: " + myConnection.State.ToString());
- myConnection.Close();
-}
- </code>
- </example>
-</ServerVersion>
+ <code lang="vbnet">
+ Public Sub CreateMySqlConnection()
+ Dim myConnString As String = _
+ "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass"
+ Dim myConnection As New MySqlConnection( myConnString )
+ myConnection.Open()
+ MessageBox.Show( "Server Version: " + myConnection.ServerVersion _
+ + ControlChars.NewLine + "Database: " + myConnection.Database )
+ myConnection.ChangeDatabase( "test2" )
+ MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion _
+ + ControlChars.NewLine + "Database: " + myConnection.Database )
+ myConnection.Close()
+ End Sub
+ </code>
-<Close>
- <summary>Closes the connection to the database. This is the preferred method of closing any open connection.</summary>
- <remarks>
- <para>The <B>Close</B> method rolls back any pending transactions. It then releases
- the connection to the connection pool, or closes the connection if connection
- pooling is disabled.</para>
- <para>An application can call <B>Close</B> more than one time. No exception is
- generated.</para>
- </remarks>
- <example>
- The following example creates a <see cref="MySqlConnection"/>, opens it,
- displays some of its properties, then closes the connection.
-
- <code lang="Visual Basic">
-Public Sub CreateMySqlConnection(myConnString As String)
- Dim myConnection As New MySqlConnection(myConnString)
- myConnection.Open()
- MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
- + ControlChars.Cr + "State: " + myConnection.State.ToString())
- myConnection.Close()
-End Sub
- </code>
- <code lang="C#">
-public void CreateMySqlConnection(string myConnString)
-{
- MySqlConnection myConnection = new MySqlConnection(myConnString);
- myConnection.Open();
- MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
- "\nState: " + myConnection.State.ToString());
- myConnection.Close();
-}
- </code>
- </example>
-</Close>
+ <code lang="C#">
+ public void CreateMySqlConnection()
+ {
+ string myConnString =
+ "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass";
+ MySqlConnection myConnection = new MySqlConnection( myConnString );
+ myConnection.Open();
+ MessageBox.Show( "Server Version: " + myConnection.ServerVersion
+ + "\nDatabase: " + myConnection.Database );
+ myConnection.ChangeDatabase( "test2" );
+ MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion
+ + "\nDatabase: " + myConnection.Database );
+ myConnection.Close();
+ }
+ </code>
+ </example>
+ </Database>
-<CreateCommand>
- <summary>Creates and returns a <see cref="MySqlCommand"/> object associated with the <see cref="MySqlConnection"/>.</summary>
- <returns>A <see cref="MySqlCommand"/> object.</returns>
-</CreateCommand>
+ <State>
+ <summary>Gets the current state of the connection.</summary>
+ <returns>
+ A bitwise combination of the <see cref="System.Data.ConnectionState"/> values. The default is <B>Closed</B>.
+ </returns>
+ <remarks>
+ The allowed state changes are:
+ <list type="bullet">
+ <item>
+ From <B>Closed</B> to <B>Open</B>, using the <B>Open</B> method of the connection object.
+ </item>
+ <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>
+ </list>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlConnection"/>, opens it,
+ displays some of its properties, then closes the connection.
-<BeginTransaction>
- <summary>Begins a database transaction.</summary>
- <returns>An object representing the new transaction.</returns>
- <exception cref="InvalidOperationException">Parallel transactions are not supported.</exception>
- <remarks>
- <para>This command is equivalent to the MySQL BEGIN TRANSACTION command.</para>
- <para>You must explicitly commit or roll back the transaction using the <see cref="MySqlTransaction.Commit"/> or
- <see cref="MySqlTransaction.Rollback"/> method.
- <note>If you do not specify an isolation level, the default isolation level is used. To specify an isolation
- level with the <see cref="BeginTransaction()"/> method, use the overload that takes the <I>iso</I> parameter. Also
- note that any attempt to begin a transaction while a transaction is in progress will throw an exception on MySQL 4.1 and higher.
- On MySQL 4.0, an exception will not be thrown because servers 4.0 and earlier did not report their transacation status.
- </note></para>
- </remarks>
- <example>
- The following example creates a <see cref="MySqlConnection"/> and a
- <see cref="MySqlTransaction"/>. It also demonstrates how to use the <B>BeginTransaction</B>, a
- <see cref="MySqlTransaction.Commit"/>, and <see cref="MySqlTransaction.Rollback"/> methods.
- <code lang="Visual Basic">
-Public Sub RunTransaction(myConnString As String)
- Dim myConnection As New MySqlConnection(myConnString)
- myConnection.Open()
-
- Dim myCommand As MySqlCommand = myConnection.CreateCommand()
- Dim myTrans As MySqlTransaction
-
- ' Start a local transaction
- myTrans = myConnection.BeginTransaction()
- ' Must assign both transaction object and connection
- ' to Command object for a pending local transaction
- myCommand.Connection = myConnection
- myCommand.Transaction = myTrans
-
- Try
- myCommand.CommandText = "Insert into Test (id, desc) VALUES (100, 'Description')"
- myCommand.ExecuteNonQuery()
- myCommand.CommandText = "Insert into Test (id, desc) VALUES (101, 'Description')"
- myCommand.ExecuteNonQuery()
- myTrans.Commit()
- Console.WriteLine("Both records are written to database.")
- Catch e As Exception
- Try
+ <code lang="vbnet">
+ Public Sub CreateMySqlConnection(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ + ControlChars.Cr + "State: " + myConnection.State.ToString())
+ myConnection.Close()
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlConnection(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
+ "\nState: " + myConnection.State.ToString());
+ myConnection.Close();
+ }
+ </code>
+ </example>
+ </State>
+
+ <ServerVersion>
+ <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="InvalidOperationException">The connection is closed.</exception>
+ <example>
+ The following example creates a <see cref="MySqlConnection"/>, opens it,
+ displays some of its properties, then closes the connection.
+
+ <code lang="vbnet">
+ Public Sub CreateMySqlConnection(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ + ControlChars.Cr + "State: " + myConnection.State.ToString())
+ myConnection.Close()
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlConnection(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
+ "\nState: " + myConnection.State.ToString());
+ myConnection.Close();
+ }
+ </code>
+ </example>
+ </ServerVersion>
+
+ <Close>
+ <summary>Closes the connection to the database. This is the preferred method of closing any open connection.</summary>
+ <remarks>
+ <para>
+ The <B>Close</B> method rolls back any pending transactions. It then releases
+ the connection to the connection pool, or closes the connection if connection
+ pooling is disabled.
+ </para>
+ <para>
+ An application can call <B>Close</B> more than one time. No exception is
+ generated.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlConnection"/>, opens it,
+ displays some of its properties, then closes the connection.
+
+ <code lang="vbnet">
+ Public Sub CreateMySqlConnection(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ + ControlChars.Cr + "State: " + myConnection.State.ToString())
+ myConnection.Close()
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateMySqlConnection(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
+ "\nState: " + myConnection.State.ToString());
+ myConnection.Close();
+ }
+ </code>
+ </example>
+ </Close>
+
+ <CreateCommand>
+ <summary>
+ Creates and returns a <see cref="MySqlCommand"/> object associated with the <see cref="MySqlConnection"/>.
+ </summary>
+ <returns>
+ A <see cref="MySqlCommand"/> object.
+ </returns>
+ </CreateCommand>
+
+ <BeginTransaction>
+ <summary>Begins a database transaction.</summary>
+ <returns>An object representing the new transaction.</returns>
+ <exception cref="InvalidOperationException">Parallel transactions are not supported.</exception>
+ <remarks>
+ <para>This command is equivalent to the MySQL BEGIN TRANSACTION command.</para>
+ <para>
+ You must explicitly commit or roll back the transaction using the <see cref="MySqlTransaction.Commit"/> or
+ <see cref="MySqlTransaction.Rollback"/> method.
+ <note>
+ If you do not specify an isolation level, the default isolation level is used. To specify an isolation
+ level with the <see cref="BeginTransaction()"/> method, use the overload that takes the <I>iso</I> parameter. Also
+ note that any attempt to begin a transaction while a transaction is in progress will throw an exception on MySQL 4.1 and higher.
+ On MySQL 4.0, an exception will not be thrown because servers 4.0 and earlier did not report their transacation status.
+ </note>
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlConnection"/> and a
+ <see cref="MySqlTransaction"/>. It also demonstrates how to use the <B>BeginTransaction</B>, a
+ <see cref="MySqlTransaction.Commit"/>, and <see cref="MySqlTransaction.Rollback"/> methods.
+ <code lang="vbnet">
+ Public Sub RunTransaction(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+
+ Dim myCommand As MySqlCommand = myConnection.CreateCommand()
+ Dim myTrans As MySqlTransaction
+
+ ' Start a local transaction
+ myTrans = myConnection.BeginTransaction()
+ ' Must assign both transaction object and connection
+ ' to Command object for a pending local transaction
+ myCommand.Connection = myConnection
+ myCommand.Transaction = myTrans
+
+ Try
+ myCommand.CommandText = "Insert into Test (id, desc) VALUES (100, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myCommand.CommandText = "Insert into Test (id, desc) VALUES (101, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myTrans.Commit()
+ Console.WriteLine("Both records are written to database.")
+ Catch e As Exception
+ Try
myTrans.Rollback()
- Catch ex As MySqlException
+ Catch ex As MySqlException
If Not myTrans.Connection Is Nothing Then
- Console.WriteLine("An exception of type " + ex.GetType().ToString() + _
- " was encountered while attempting to roll back the transaction.")
+ Console.WriteLine("An exception of type " + ex.GetType().ToString() + _
+ " was encountered while attempting to roll back the transaction.")
End If
- End Try
-
- Console.WriteLine("An exception of type " + e.GetType().ToString() + _
- "was encountered while inserting the data.")
- Console.WriteLine("Neither record was written to database.")
- Finally
- myConnection.Close()
- End Try
-End Sub
- </code>
- <code lang="C#">
-public void RunTransaction(string myConnString)
-{
- MySqlConnection myConnection = new MySqlConnection(myConnString);
- myConnection.Open();
+ End Try
- MySqlCommand myCommand = myConnection.CreateCommand();
- MySqlTransaction myTrans;
+ Console.WriteLine("An exception of type " + e.GetType().ToString() + _
+ "was encountered while inserting the data.")
+ Console.WriteLine("Neither record was written to database.")
+ Finally
+ myConnection.Close()
+ End Try
+ End Sub
+ </code>
+ <code lang="C#">
+ public void RunTransaction(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
- // Start a local transaction
- myTrans = myConnection.BeginTransaction();
- // Must assign both transaction object and connection
- // to Command object for a pending local transaction
- myCommand.Connection = myConnection;
- myCommand.Transaction = myTrans;
+ MySqlCommand myCommand = myConnection.CreateCommand();
+ MySqlTransaction myTrans;
- try
- {
- myCommand.CommandText = "insert into Test (id, desc) VALUES (100, 'Description')";
- myCommand.ExecuteNonQuery();
- myCommand.CommandText = "insert into Test (id, desc) VALUES (101, 'Description')";
- myCommand.ExecuteNonQuery();
- myTrans.Commit();
- Console.WriteLine("Both records are written to database.");
- }
- catch(Exception e)
- {
- try
- {
+ // Start a local transaction
+ myTrans = myConnection.BeginTransaction();
+ // Must assign both transaction object and connection
+ // to Command object for a pending local transaction
+ myCommand.Connection = myConnection;
+ myCommand.Transaction = myTrans;
+
+ try
+ {
+ myCommand.CommandText = "insert into Test (id, desc) VALUES (100, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myCommand.CommandText = "insert into Test (id, desc) VALUES (101, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myTrans.Commit();
+ Console.WriteLine("Both records are written to database.");
+ }
+ catch(Exception e)
+ {
+ try
+ {
myTrans.Rollback();
- }
- catch (SqlException ex)
- {
+ }
+ catch (SqlException ex)
+ {
if (myTrans.Connection != null)
{
- Console.WriteLine("An exception of type " + ex.GetType() +
- " was encountered while attempting to roll back the transaction.");
+ Console.WriteLine("An exception of type " + ex.GetType() +
+ " was encountered while attempting to roll back the transaction.");
}
- }
-
- Console.WriteLine("An exception of type " + e.GetType() +
- " was encountered while inserting the data.");
- Console.WriteLine("Neither record was written to database.");
- }
- finally
- {
- myConnection.Close();
- }
-}
- </code>
- </example>
-</BeginTransaction>
+ }
-<BeginTransaction1>
- <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="InvalidOperationException">Parallel exceptions are not supported.</exception>
- <remarks>
- <para>This command is equivalent to the MySQL BEGIN TRANSACTION command.</para>
- <para>You must explicitly commit or roll back the transaction using the <see cref="MySqlTransaction.Commit"/> or
- <see cref="MySqlTransaction.Rollback"/> method.
- <note>If you do not specify an isolation level, the default isolation level is used. To specify an isolation
- level with the <see cref="BeginTransaction()"/> method, use the overload that takes the <I>iso</I> parameter.
- Also note that any attempt to begin a transaction while a transaction is in progress will throw an exception on MySQL 4.1 and higher.
- On MySQL 4.0, an exception will not be thrown because servers 4.0 and earlier did not report their transacation status.
- </note></para>
- </remarks>
- <example>
- The following example creates a <see cref="MySqlConnection"/> and a
- <see cref="MySqlTransaction"/>. It also demonstrates how to use the <B>BeginTransaction</B>, a
- <see cref="MySqlTransaction.Commit"/>, and <see cref="MySqlTransaction.Rollback"/> methods.
- <code lang="Visual Basic">
-Public Sub RunTransaction(myConnString As String)
- Dim myConnection As New MySqlConnection(myConnString)
- myConnection.Open()
-
- Dim myCommand As MySqlCommand = myConnection.CreateCommand()
- Dim myTrans As MySqlTransaction
-
- ' Start a local transaction
- myTrans = myConnection.BeginTransaction()
- ' Must assign both transaction object and connection
- ' to Command object for a pending local transaction
- myCommand.Connection = myConnection
- myCommand.Transaction = myTrans
-
- Try
- myCommand.CommandText = "Insert into Test (id, desc) VALUES (100, 'Description')"
- myCommand.ExecuteNonQuery()
- myCommand.CommandText = "Insert into Test (id, desc) VALUES (101, 'Description')"
- myCommand.ExecuteNonQuery()
- myTrans.Commit()
- Console.WriteLine("Both records are written to database.")
- Catch e As Exception
- Try
+ Console.WriteLine("An exception of type " + e.GetType() +
+ " was encountered while inserting the data.");
+ Console.WriteLine("Neither record was written to database.");
+ }
+ finally
+ {
+ myConnection.Close();
+ }
+ }
+ </code>
+ </example>
+ </BeginTransaction>
+
+ <BeginTransaction1>
+ <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="InvalidOperationException">Parallel exceptions are not supported.</exception>
+ <remarks>
+ <para>This command is equivalent to the MySQL BEGIN TRANSACTION command.</para>
+ <para>
+ You must explicitly commit or roll back the transaction using the <see cref="MySqlTransaction.Commit"/> or
+ <see cref="MySqlTransaction.Rollback"/> method.
+ <note>
+ If you do not specify an isolation level, the default isolation level is used. To specify an isolation
+ level with the <see cref="BeginTransaction()"/> method, use the overload that takes the <I>iso</I> parameter.
+ Also note that any attempt to begin a transaction while a transaction is in progress will throw an exception on MySQL 4.1 and higher.
+ On MySQL 4.0, an exception will not be thrown because servers 4.0 and earlier did not report their transacation status.
+ </note>
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlConnection"/> and a
+ <see cref="MySqlTransaction"/>. It also demonstrates how to use the <B>BeginTransaction</B>, a
+ <see cref="MySqlTransaction.Commit"/>, and <see cref="MySqlTransaction.Rollback"/> methods.
+ <code lang="vbnet">
+ Public Sub RunTransaction(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+
+ Dim myCommand As MySqlCommand = myConnection.CreateCommand()
+ Dim myTrans As MySqlTransaction
+
+ ' Start a local transaction
+ myTrans = myConnection.BeginTransaction()
+ ' Must assign both transaction object and connection
+ ' to Command object for a pending local transaction
+ myCommand.Connection = myConnection
+ myCommand.Transaction = myTrans
+
+ Try
+ myCommand.CommandText = "Insert into Test (id, desc) VALUES (100, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myCommand.CommandText = "Insert into Test (id, desc) VALUES (101, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myTrans.Commit()
+ Console.WriteLine("Both records are written to database.")
+ Catch e As Exception
+ Try
myTrans.Rollback()
- Catch ex As MySqlException
+ Catch ex As MySqlException
If Not myTrans.Connection Is Nothing Then
- Console.WriteLine("An exception of type " + ex.GetType().ToString() + _
- " was encountered while attempting to roll back the transaction.")
+ Console.WriteLine("An exception of type " + ex.GetType().ToString() + _
+ " was encountered while attempting to roll back the transaction.")
End If
- End Try
-
- Console.WriteLine("An exception of type " + e.GetType().ToString() + _
- "was encountered while inserting the data.")
- Console.WriteLine("Neither record was written to database.")
- Finally
- myConnection.Close()
- End Try
-End Sub
- </code>
- <code lang="C#">
-public void RunTransaction(string myConnString)
-{
- MySqlConnection myConnection = new MySqlConnection(myConnString);
- myConnection.Open();
+ End Try
- MySqlCommand myCommand = myConnection.CreateCommand();
- MySqlTransaction myTrans;
+ Console.WriteLine("An exception of type " + e.GetType().ToString() + _
+ "was encountered while inserting the data.")
+ Console.WriteLine("Neither record was written to database.")
+ Finally
+ myConnection.Close()
+ End Try
+ End Sub
+ </code>
+ <code lang="C#">
+ public void RunTransaction(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
- // Start a local transaction
- myTrans = myConnection.BeginTransaction();
- // Must assign both transaction object and connection
- // to Command object for a pending local transaction
- myCommand.Connection = myConnection;
- myCommand.Transaction = myTrans;
+ MySqlCommand myCommand = myConnection.CreateCommand();
+ MySqlTransaction myTrans;
- try
- {
- myCommand.CommandText = "insert into Test (id, desc) VALUES (100, 'Description')";
- myCommand.ExecuteNonQuery();
- myCommand.CommandText = "insert into Test (id, desc) VALUES (101, 'Description')";
- myCommand.ExecuteNonQuery();
- myTrans.Commit();
- Console.WriteLine("Both records are written to database.");
- }
- catch(Exception e)
- {
- try
- {
+ // Start a local transaction
+ myTrans = myConnection.BeginTransaction();
+ // Must assign both transaction object and connection
+ // to Command object for a pending local transaction
+ myCommand.Connection = myConnection;
+ myCommand.Transaction = myTrans;
+
+ try
+ {
+ myCommand.CommandText = "insert into Test (id, desc) VALUES (100, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myCommand.CommandText = "insert into Test (id, desc) VALUES (101, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myTrans.Commit();
+ Console.WriteLine("Both records are written to database.");
+ }
+ catch(Exception e)
+ {
+ try
+ {
myTrans.Rollback();
- }
- catch (SqlException ex)
- {
+ }
+ catch (SqlException ex)
+ {
if (myTrans.Connection != null)
{
- Console.WriteLine("An exception of type " + ex.GetType() +
- " was encountered while attempting to roll back the transaction.");
+ Console.WriteLine("An exception of type " + ex.GetType() +
+ " was encountered while attempting to roll back the transaction.");
}
- }
-
- Console.WriteLine("An exception of type " + e.GetType() +
- " was encountered while inserting the data.");
- Console.WriteLine("Neither record was written to database.");
- }
- finally
- {
- myConnection.Close();
- }
-}
- </code>
- </example>
-</BeginTransaction1>
+ }
-<ChangeDatabase>
- <summary>Changes the current database for an open MySqlConnection.</summary>
- <param name="database">The name of the database to use.</param>
- <remarks>
- <para>The value supplied in the <I>database</I> parameter must be a valid database
- name. The <I>database</I> parameter cannot contain a null value, an empty
- string, or a string with only blank characters.</para>
-
- <para>When you are using connection pooling against MySQL, and you close
- the connection, it is returned to the connection pool. The next time the
- connection is retrieved from the pool, the reset connection request
- executes before the user performs any operations.</para>
- </remarks>
- <exception cref="ArgumentException">The database name is not valid.</exception>
- <exception cref="InvalidOperationException">The connection is not open.</exception>
- <exception cref="MySqlException">Cannot change the database.</exception>
- <example>
- The following example creates a <see cref="MySqlConnection"/> and displays
- some of its read-only properties.
-
- <code lang="Visual Basic">
-Public Sub CreateMySqlConnection()
- Dim myConnString As String = _
- "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass"
- Dim myConnection As New MySqlConnection( myConnString )
- myConnection.Open()
- MessageBox.Show( "Server Version: " + myConnection.ServerVersion _
- + ControlChars.NewLine + "Database: " + myConnection.Database )
- myConnection.ChangeDatabase( "test2" )
- MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion _
- + ControlChars.NewLine + "Database: " + myConnection.Database )
- myConnection.Close()
-End Sub
- </code>
-
- <code lang="C#">
-public void CreateMySqlConnection()
-{
- string myConnString =
- "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass";
- MySqlConnection myConnection = new MySqlConnection( myConnString );
- myConnection.Open();
- MessageBox.Show( "Server Version: " + myConnection.ServerVersion
- + "\nDatabase: " + myConnection.Database );
- myConnection.ChangeDatabase( "test2" );
- MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion
- + "\nDatabase: " + myConnection.Database );
- myConnection.Close();
-}
- </code>
- </example>
-</ChangeDatabase>
+ Console.WriteLine("An exception of type " + e.GetType() +
+ " was encountered while inserting the data.");
+ Console.WriteLine("Neither record was written to database.");
+ }
+ finally
+ {
+ myConnection.Close();
+ }
+ }
+ </code>
+ </example>
+ </BeginTransaction1>
-<StateChange>
- <summary>Occurs when the state of the connection changes.</summary>
- <remarks>
- <para>The <B>StateChange</B> event fires whenever the <see cref="State"/> changes from
- closed to opened, or from opened to closed. <B>StateChange</B> fires immediately
- after the <see cref="MySqlConnection"/> transitions.</para>
-
- <para>If an event handler throws an exception from within the <B>StateChange</B>
- event, the exception propagates to the caller of the <see cref="Open"/> or
- <see cref="Close"/> method.</para>
-
- <para>The <B>StateChange</B> event is not raised unless you explicitly call
- <B>Close</B> or <B>Dispose</B>.</para>
- </remarks>
- <event cref="StateChange">
- Raised.
- <data>
- <para>The event handler receives an argument of type <see cref="System.Data.StateChangeEventArgs"/>
- containing data related to this event. The following <B>StateChangeEventArgs</B>
- properties provide information specific to this event.</para>
- <list type="table">
- <listheader>
- <term>Property</term>
- <description>Description</description>
- </listheader>
- <item>
- <term><see cref="System.Data.StateChangeEventArgs.CurrentState"/></term>
- <description>Gets the new state of the connection. The connection object will
- be in the new state already when the event is fired.</description>
- </item>
- <item>
- <term><see cref="System.Data.StateChangeEventArgs.OriginalState"/></term>
- <description>Gets the original state of the connection.</description>
- </item>
- </list>
- </data>
- </event>
-</StateChange>
+ <ChangeDatabase>
+ <summary>Changes the current database for an open MySqlConnection.</summary>
+ <param name="database">The name of the database to use.</param>
+ <remarks>
+ <para>
+ The value supplied in the <I>database</I> parameter must be a valid database
+ name. The <I>database</I> parameter cannot contain a null value, an empty
+ string, or a string with only blank characters.
+ </para>
-<InfoMessage>
- <summary>Occurs when MySQL returns warnings as a result of executing a command or query.</summary>
- <remarks>
- </remarks>
-</InfoMessage>
+ <para>
+ When you are using connection pooling against MySQL, and you close
+ the connection, it is returned to the connection pool. The next time the
+ connection is retrieved from the pool, the reset connection request
+ executes before the user performs any operations.
+ </para>
+ </remarks>
+ <exception cref="ArgumentException">The database name is not valid.</exception>
+ <exception cref="InvalidOperationException">The connection is not open.</exception>
+ <exception cref="MySqlException">Cannot change the database.</exception>
+ <example>
+ The following example creates a <see cref="MySqlConnection"/> and displays
+ some of its read-only properties.
-<ClassSummary>
- <summary>
- Represents an open connection to a MySQL Server database. This class cannot be inherited.
- </summary>
- <remarks>
- <para>
- A <b>MySqlConnection</b> object represents a session to a MySQL Server
- data source. When you create an instance of <B>MySqlConnection</B>, all
- properties are set to their initial values. For a list of these values, see the
- <B>MySqlConnection</B> constructor.
- </para>
-
- <para>
- If the <B>MySqlConnection</B> goes out of scope, it is not closed. Therefore,
- you must explicitly close the connection by calling <see cref="MySqlConnection.Close"/>
- or <see cref="MySqlConnection.Dispose"/>.
- </para>
- </remarks>
+ <code lang="vbnet">
+ Public Sub CreateMySqlConnection()
+ Dim myConnString As String = _
+ "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass"
+ Dim myConnection As New MySqlConnection( myConnString )
+ myConnection.Open()
+ MessageBox.Show( "Server Version: " + myConnection.ServerVersion _
+ + ControlChars.NewLine + "Database: " + myConnection.Database )
+ myConnection.ChangeDatabase( "test2" )
+ MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion _
+ + ControlChars.NewLine + "Database: " + myConnection.Database )
+ myConnection.Close()
+ End Sub
+ </code>
- <example>
- The following example creates a <see cref="MySqlCommand"/> and
- a <B>MySqlConnection</B>. The <B>MySqlConnection</B> is opened and set as the
- <see cref="MySqlCommand.Connection"/> for the <B>MySqlCommand</B>. The example then calls
- <see cref="MySqlCommand.ExecuteNonQuery"/>, and closes the connection. To accomplish this, the <B>ExecuteNonQuery</B> is
- passed a connection string and a query string that is a SQL INSERT
- statement.
- <code lang="Visual Basic">
- <c>
- Public Sub InsertRow(myConnectionString As String)
- ' If the connection string is null, use a default.
- If myConnectionString = "" Then
- myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"
- End If
- Dim myConnection As New MySqlConnection(myConnectionString)
- Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"
- Dim myCommand As New MySqlCommand(myInsertQuery)
- myCommand.Connection = myConnection
- myConnection.Open()
- myCommand.ExecuteNonQuery()
- myCommand.Connection.Close()
- End Sub
- </c>
- </code>
- <code lang="C#">
- <c>
- public void InsertRow(string myConnectionString)
- {
- // If the connection string is null, use a default.
- if(myConnectionString == "")
- {
- myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass";
- }
- MySqlConnection myConnection = new MySqlConnection(myConnectionString);
- string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)";
- MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
- myCommand.Connection = myConnection;
- myConnection.Open();
- myCommand.ExecuteNonQuery();
- myCommand.Connection.Close();
- }
- </c>
- </code>
- </example>
-</ClassSummary>
+ <code lang="C#">
+ public void CreateMySqlConnection()
+ {
+ string myConnString =
+ "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass";
+ MySqlConnection myConnection = new MySqlConnection( myConnString );
+ myConnection.Open();
+ MessageBox.Show( "Server Version: " + myConnection.ServerVersion
+ + "\nDatabase: " + myConnection.Database );
+ myConnection.ChangeDatabase( "test2" );
+ MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion
+ + "\nDatabase: " + myConnection.Database );
+ myConnection.Close();
+ }
+ </code>
+ </example>
+ </ChangeDatabase>
-<ConnectionTimeout>
- <summary>
- Gets the time to wait while trying to establish a connection before terminating the attempt and generating an error.
- </summary>
- <exception cref="System.ArgumentException">The value set is less than 0.</exception>
- <remarks>
- A value of 0 indicates no limit, and should be avoided in a
- <see cref="MySqlConnection.ConnectionString"/> because an attempt to connect
- will wait indefinitely.
- </remarks>
- <example>
- The following example creates a MySqlConnection
- and sets some of its properties in the connection string.
- <code lang="Visual Basic">
-Public Sub CreateSqlConnection()
- Dim myConnection As New MySqlConnection()
- myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30"
- myConnection.Open()
-End Sub
-</code>
-<code lang="C#">
-public void CreateSqlConnection()
-{
- MySqlConnection myConnection = new MySqlConnection();
- myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30";
- myConnection.Open();
-}
-</code>
- </example>
-</ConnectionTimeout>
+ <StateChange>
+ <summary>Occurs when the state of the connection changes.</summary>
+ <remarks>
+ <para>
+ The <B>StateChange</B> event fires whenever the <see cref="State"/> changes from
+ closed to opened, or from opened to closed. <B>StateChange</B> fires immediately
+ after the <see cref="MySqlConnection"/> transitions.
+ </para>
+ <para>
+ If an event handler throws an exception from within the <B>StateChange</B>
+ event, the exception propagates to the caller of the <see cref="Open"/> or
+ <see cref="Close"/> method.
+ </para>
-<ConnectionString>
- <summary>
- Gets or sets the string used to connect to a MySQL Server database.
- </summary>
- <remarks>
- <para>The <B>ConnectionString</B> returned may not be exactly like what was originally
- set but will be indentical in terms of keyword/value pairs. Security information
- will not be included unless the Persist Security Info value is set to true.
- </para>
- <para>You can use the <B>ConnectionString</B> property to connect to a database.
- The following example illustrates a typical connection string.</para>
- <c>"Persist Security Info=False;database=MyDB;server=MySqlServer;user id=myUser;Password=myPass"</c>
- <para>The <B>ConnectionString</B> property can be set only when the connection is
- closed. Many of the connection string values have corresponding read-only
- properties. When the connection string is set, all of these properties are
- updated, except when an error is detected. In this case, none of the properties
- are updated. <see cref="MySqlConnection"/> properties return only those settings contained in the
- <B>ConnectionString</B>.</para>
- <para>To connect to a local machine, specify "localhost" for the server. If you do not
- specify a server, localhost is assumed.</para>
- <para>Resetting the <B>ConnectionString</B> on a closed connection resets all
- connection string values (and related properties) including the password. For
- example, if you set a connection string that includes "Database= MyDb", and
- then reset the connection string to "Data Source=myserver;User Id=myUser;Password=myPass",
- the <see cref="MySqlConnection.Database"/> property is no longer set to MyDb.</para>
- <para>The connection string is parsed immediately after being set. If errors in
- syntax are found when parsing, a runtime exception, such as <see cref="ArgumentException"/>,
- is generated. Other errors can be found only when an attempt is made to open the
- connection.</para>
- <para>The basic format of a connection string consists of a series of keyword/value
- pairs separated by semicolons. The equal sign (=) connects each keyword and its
- value. To include values that contain a semicolon, single-quote character, or
- double-quote character, the value must be enclosed in double quotes. If the
- value contains both a semicolon and a double-quote character, the value can be
- enclosed in single quotes. The single quote is also useful if the value begins
- with a double-quote character. Conversely, the double quote can be used if the
- value begins with a single quote. If the value contains both single-quote and
- double-quote characters, the quote character used to enclose the value must be
- doubled each time it occurs within the value.</para>
- <para>To include preceding or trailing spaces in the string value, the value must
- be enclosed in either single quotes or double quotes. Any leading or trailing
- spaces around integer, Boolean, or enumerated values are ignored, even if
- enclosed in quotes. However, spaces within a string literal keyword or value are
- preserved. Using .NET Framework version 1.1, single or double quotes may be used
- within a connection string without using delimiters (for example, Data Source=
- my'Server or Data Source= my"Server), unless a quote character is the first or
- last character in the value.</para>
- <para>To include an equal sign (=) in a keyword or value, it must be preceded by
- another equal sign. For example, in the hypothetical connection string</para>
- <c>"key==word=value"</c>
- <para></para>
- <para>the keyword is "key=word" and the value is "value".</para>
- <para>If a specific keyword in a keyword= value pair occurs multiple times in a
- connection string, the last occurrence listed is used in the value set.</para>
- <para>Keywords are not case sensitive.</para>
- <para>The following table lists the valid names for keyword values within the
- <B>ConnectionString</B>.</para>
-
- <div class="tablediv"><table class="dtTABLE" cellspacing="0"><tr valign="top">
- <th width="33%">Name</th>
- <th width="33%">Default</th>
- <th width="33%">Description</th>
- </tr>
- <tr>
- <td>Connect Timeout<para> -or- </para>Connection Timeout</td>
- <td>15</td>
- <td>The length of time (in seconds) to wait for a connection to the server before
-terminating the attempt and generating an error.</td>
- </tr>
- <tr>
- <td>
- Host<para> -or- </para>Server<para> -or- </para>Data Source<para> -or- </para>
- DataSource<para> -or- </para>Address<para> -or- </para>Addr<para> -or- </para>
- Network Address
- </td>
- <td>localhost</td>
- <td><para>The name or network address of the instance of MySQL to which to connect. Multiple hosts can be
- specified separated by &. This can be useful where multiple MySQL servers are configured for replication
- and you are not concerned about the precise server you are connecting to. No attempt is made by the provider to
- synchronize writes to the database so care should be taken when using this option.
- </para>
- <para>
- 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.
- Currently only a single socket name can be given so accessing MySQL in a replicated environment using Unix sockets is not currently supported.
- </para>
- </td>
- </tr>
- <tr>
- <td>Port</td>
- <td>3306</td>
- <td>The port MySQL is using to listen for connections. Specify -1 for this value to use a
- named pipe connection (Windows only). This value is ignored if Unix socket is used.</td>
- </tr>
- <tr>
- <td>Protocol</td>
- <td>socket</td>
- <td>
- Specifies the type of connection to make to the server.<para>Values can be:</para>
- socket or tcp for a socket connection<br/>
- pipe for a named pipe connection<br/>
- unix for a Unix socket connection<br/>
- memory to use MySQL shared memory
- </td>
- </tr>
- <tr>
- <td>CharSet<para> -or </para>Character Set</td>
- <td></td>
- <td>
- Specifies the character set that should be used to encode all queries sent to the server.
- Resultsets are still returned in the character set of the data returned.
- </td>
- </tr>
- <tr>
- <td>Logging</td>
- <td>false</td>
- <td>When true, various pieces of information is output to any configured TraceListeners.</td>
- </tr>
- <tr>
- <td>Allow Batch</td>
- <td>true</td>
- <td>
- When true, multiple SQL statements can be sent with one command execution.<br/><br/>
- -Note-<br/>
- Starting with MySQL 4.1.1, batch statements should be separated by the server-defined seperator character.<br/>
- Commands sent to earlier versions of MySQL should be seperated with ';'.
- </td>
- </tr>
- <tr>
- <td>Encrypt</td>
- <td>false</td>
- <td>When <B>true</B>, SSL/TLS encryption is used for all data sent between the
-client and server if the server has a certificate installed. Recognized values
-are <B>true</B>, <B>false</B>, <B>yes</B>, and <B>no</B>.
- </td>
- </tr>
- <tr>
- <td>Initial Catalog<para> -or- </para>Database</td>
- <td>mysql</td>
- <td>The name of the database to use intially</td>
- </tr>
- <tr>
- <td>Password<para> -or- </para>pwd</td>
- <td></td>
- <td>The password for the MySQL account being used.</td>
- </tr>
- <tr>
- <td>Persist Security Info</td>
- <td>false</td>
- <td>When set to <B>false</B> or <B>no</B> (strongly recommended), security-sensitive
-information, such as the password, is not returned as part of the connection if
-the connection is open or has ever been in an open state. Resetting the
-connection string resets all connection string values including the password.
-Recognized values are <B>true</B>, <B>false</B>, <B>yes</B>, and <B>no</B>.</td>
- </tr>
- <tr>
- <td>User Id<para> -or- </para>Username<para> -or- </para>Uid<para> -or- </para>User name</td>
- <td></td>
- <td>The MySQL login account being used.</td>
- </tr>
- <tr>
- <td>Shared Memory Name</td>
- <td>MYSQL</td>
- <td>The name of the shared memory object to use for communication if the connection protocol is set to memory.</td>
- </tr>
- <tr>
- <td>Allow Zero Datetime</td>
- <td>false</td>
- <td>True to have MySqlDataReader.GetValue() return a MySqlDateTime for date or datetime columns that have illegal values.
- False will cause a DateTime object to be returned for legal values and an exception will be thrown for illegal values.</td>
- </tr>
- <tr>
- <td>Convert Zero Datetime</td>
- <td>false</td>
- <td>True to have MySqlDataReader.GetValue() and MySqlDataReader.GetDateTime()
- return DateTime.MinValue for date or datetime columns that have illegal values.</td>
- </tr>
- <tr>
- <td>Old Syntax<para> -or- </para>OldSyntax</td>
- <td>false</td>
- <td>
- Allows use of '@' symbol as a parameter marker. See <see cref="MySqlCommand"/> for more
- info.
- <note>This is for compatibility only. All future code should be written to
- use the new '?' parameter marker.</note>
- </td>
- </tr>
- <tr>
- <td>Pipe Name<para> -or- </para>Pipe</td>
- <td>mysql</td>
- <td>When set to the name of a named pipe, the <B>MySqlConnection</B> will attempt to connect to MySQL
- on that named pipe.<br/><br/>This settings only applies to the Windows platform.</td>
- </tr>
- <tr>
- <td>
- Use Performance Monitor<para> -or- </para>UsePerformanceMonitor
- </td>
- <td>false</td>
- <td>
- Posts performance data that can be tracked using perfmon
- </td>
- </tr>
- <tr>
- <td>
- Procedure Cache Size
- </td>
- <td>25</td>
- <td>
- How many stored procedure definitions can be held in the cache
- </td>
- </tr>
- <tr>
- <td>
- Ignore Prepare
- </td>
- <td>true</td>
- <td>
- Instructs the provider to ignore any attempts to prepare commands. This option
- was added to allow a user to disable prepared statements in an entire application
- without modifying the code. A user might want to do this if errors or bugs are
- encountered with MySQL prepared statements.
- </td>
- </tr>
- <tr>
- <td>Use Procedure Bodies</td>
- <td>true</td>
- <td>
- Instructs the provider to attempt to call the procedure without first resolving the metadata. Thjis
- is useful in situations where the calling user does not have access to the mysql.proc table. To
- use this mode, the parameters for the procedure must be added to the command in the same order
- as they appear in the procedure definition and their types must be explicitly set.
- </td>
- </tr>
- <tr>
- <td>Auto Enlist</td>
- <td>true</td>
- <td>
- Indicates whether the connection should automatically enlist in the current transaction,
- if there is one.
- </td>
- </tr>
- <tr>
- <td>Respect Binary Flags</td>
- <td>true</td>
- <td>
- Indicates whether the connection should respect all binary flags sent to the client
- as part of column metadata. False will cause the connector to behave like
- Connector/Net 5.0 and earlier.
- </td>
- </tr>
- <tr>
- <td>BlobAsUTF8IncludePattern</td>
- <td>null</td>
- <td>
- Pattern that should be used to indicate which blob columns should be treated as UTF-8.
- </td>
- </tr>
- <tr>
- <td>BlobAsUTF8ExcludePattern</td>
- <td>null</td>
- <td>
- Pattern that should be used to indicate which blob columns should not be treated as UTF-8.
- </td>
- </tr>
- </table>
-</div>
-<para>
- The following table lists the valid names for connection pooling values within
-the <B>ConnectionString</B>. For more information about connection pooling, see
-Connection Pooling for the MySql Data Provider.</para>
- <div class="tablediv"><table class="dtTABLE" cellspacing="0"><tr valign="top">
- <th width="33%">Name</th>
- <th width="33%">Default</th>
- <th width="33%">Description</th>
- </tr>
- <tr>
- <td>Connection Lifetime</td>
- <td>0</td>
- <td>When a connection is returned to the pool, its creation time is compared with
-the current time, and the connection is destroyed if that time span (in seconds)
-exceeds the value specified by <B>Connection Lifetime</B>. This is useful in
-clustered configurations to force load balancing between a running server and a
-server just brought online.
-<para>A value of zero (0) causes pooled connections to have the maximum connection
-timeout.</para></td>
- </tr>
- <tr>
- <td>Max Pool Size</td>
- <td>100</td>
- <td>The maximum number of connections allowed in the pool.</td>
- </tr>
- <tr>
- <td>Min Pool Size</td>
- <td>0</td>
- <td>The minimum number of connections allowed in the pool.</td>
- </tr>
- <tr>
- <td>Pooling</td>
- <td>true</td>
- <td>When <B>true</B>, the <B>MySqlConnection</B> object is drawn from the appropriate
-pool, or if necessary, is created and added to the appropriate pool. Recognized
-values are <B>true</B>, <B>false</B>, <B>yes</B>, and <B>no</B>.</td>
- </tr>
- <tr>
- <td>Connection Reset</td>
- <td>false</td>
- <td>Specifies whether the database connection should be reset when being
- drawn from the pool. Leaving this as <b>false</b> will yeild much faster
- connection opens but the user should understand the side effects
- of doing this such as temporary tables and user variables from the previous
- session not being cleared out.</td>
- </tr>
- </table></div>
-<para>When setting keyword or connection pooling values that require a Boolean
-value, you can use 'yes' instead of 'true', and 'no' instead of 'false'.</para>
-<para><B>Note</B> The MySql Data Provider uses the native socket protocol to
-communicate with MySQL. Therefore, it does not support the use of an ODBC data source name (DSN) when
-connecting to MySQL because it does not add an ODBC layer.</para>
-<para><B>CAUTION</B> In this release, the application should use caution when constructing a
-connection string based on user input (for example when retrieving user ID and password information from a
-dialog box, and appending it to the connection string). The application should
-ensure that a user cannot embed extra connection string parameters in these
-values (for example, entering a password as "validpassword;database=somedb" in
-an attempt to attach to a different database).</para>
- </remarks>
- <example>
- The following example creates a <see cref="MySqlConnection"/> and sets some of its properties
- <code lang="Visual Basic">
- Public Sub CreateConnection()
- Dim myConnection As New MySqlConnection()
- myConnection.ConnectionString = "Persist Security Info=False;database=myDB;server=myHost;Connect Timeout=30;user id=myUser; pwd=myPass"
- myConnection.Open()
- End Sub 'CreateConnection
- </code>
- <code lang="C#">
- public void CreateConnection()
- {
- MySqlConnection myConnection = new MySqlConnection();
- myConnection.ConnectionString = "Persist Security Info=False;database=myDB;server=myHost;Connect Timeout=30;user id=myUser; pwd=myPass";
- myConnection.Open();
- }
- </code>
-</example>
- <example>
- The following example creates a <see cref="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.
- <code lang="Visual Basic">
- Public Sub CreateConnection()
- Dim myConnection As New MySqlConnection()
- myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass"
- myConnection.Open()
- End Sub 'CreateConnection
- </code>
- <code lang="C#">
- public void CreateConnection()
- {
- MySqlConnection myConnection = new MySqlConnection();
- myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass";
- myConnection.Open();
- }
- </code>
- </example>
-</ConnectionString>
+ <para>
+ The <B>StateChange</B> event is not raised unless you explicitly call
+ <B>Close</B> or <B>Dispose</B>.
+ </para>
+ </remarks>
+ <event cref="StateChange">
+ Raised.
+ <data>
+ <para>
+ The event handler receives an argument of type <see cref="System.Data.StateChangeEventArgs"/>
+ containing data related to this event. The following <B>StateChangeEventArgs</B>
+ properties provide information specific to this event.
+ </para>
+ <list type="table">
+ <listheader>
+ <term>Property</term>
+ <description>Description</description>
+ </listheader>
+ <item>
+ <term>
+ <see cref="System.Data.StateChangeEventArgs.CurrentState"/>
+ </term>
+ <description>
+ Gets the new state of the connection. The connection object will
+ be in the new state already when the event is fired.
+ </description>
+ </item>
+ <item>
+ <term>
+ <see cref="System.Data.StateChangeEventArgs.OriginalState"/>
+ </term>
+ <description>Gets the original state of the connection.</description>
+ </item>
+ </list>
+ </data>
+ </event>
+ </StateChange>
+
+ <InfoMessage>
+ <summary>Occurs when MySQL returns warnings as a result of executing a command or query.</summary>
+ <remarks>
+ </remarks>
+ </InfoMessage>
+
+ <ClassSummary>
+ <summary>
+ Represents an open connection to a MySQL Server database. This class cannot be inherited.
+ </summary>
+ <remarks>
+ <para>
+ A <b>MySqlConnection</b> object represents a session to a MySQL Server
+ data source. When you create an instance of <B>MySqlConnection</B>, all
+ properties are set to their initial values. For a list of these values, see the
+ <B>MySqlConnection</B> constructor.
+ </para>
+
+ <para>
+ If the <B>MySqlConnection</B> goes out of scope, it is not closed. Therefore,
+ you must explicitly close the connection by calling <see cref="MySqlConnection.Close"/>
+ or <see cref="MySqlConnection.Dispose"/>.
+ </para>
+ </remarks>
+
+ <example>
+ The following example creates a <see cref="MySqlCommand"/> and
+ a <B>MySqlConnection</B>. The <B>MySqlConnection</B> is opened and set as the
+ <see cref="MySqlCommand.Connection"/> for the <B>MySqlCommand</B>. The example then calls
+ <see cref="MySqlCommand.ExecuteNonQuery"/>, and closes the connection. To accomplish this, the <B>ExecuteNonQuery</B> is
+ passed a connection string and a query string that is a SQL INSERT
+ statement.
+ <code lang="vbnet">
+ <c>
+ Public Sub InsertRow(myConnectionString As String)
+ ' If the connection string is null, use a default.
+ If myConnectionString = "" Then
+ myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"
+ End If
+ Dim myConnection As New MySqlConnection(myConnectionString)
+ Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"
+ Dim myCommand As New MySqlCommand(myInsertQuery)
+ myCommand.Connection = myConnection
+ myConnection.Open()
+ myCommand.ExecuteNonQuery()
+ myCommand.Connection.Close()
+ End Sub
+ </c>
+ </code>
+ <code lang="C#">
+ <c>
+ public void InsertRow(string myConnectionString)
+ {
+ // If the connection string is null, use a default.
+ if(myConnectionString == "")
+ {
+ myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass";
+ }
+ MySqlConnection myConnection = new MySqlConnection(myConnectionString);
+ string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)";
+ MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
+ myCommand.Connection = myConnection;
+ myConnection.Open();
+ myCommand.ExecuteNonQuery();
+ myCommand.Connection.Close();
+ }
+ </c>
+ </code>
+ </example>
+ </ClassSummary>
+
+ <ConnectionTimeout>
+ <summary>
+ Gets the time to wait while trying to establish a connection before terminating the attempt and generating an error.
+ </summary>
+ <exception cref="System.ArgumentException">The value set is less than 0.</exception>
+ <remarks>
+ A value of 0 indicates no limit, and should be avoided in a
+ <see cref="MySqlConnection.ConnectionString"/> because an attempt to connect
+ will wait indefinitely.
+ </remarks>
+ <example>
+ The following example creates a MySqlConnection
+ and sets some of its properties in the connection string.
+ <code lang="vbnet">
+ Public Sub CreateSqlConnection()
+ Dim myConnection As New MySqlConnection()
+ myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30"
+ myConnection.Open()
+ End Sub
+ </code>
+ <code lang="C#">
+ public void CreateSqlConnection()
+ {
+ MySqlConnection myConnection = new MySqlConnection();
+ myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30";
+ myConnection.Open();
+ }
+ </code>
+ </example>
+ </ConnectionTimeout>
+
+
+ <ConnectionString>
+ <summary>
+ Gets or sets the string used to connect to a MySQL Server database.
+ </summary>
+ <remarks>
+ <para>
+ The <B>ConnectionString</B> returned may not be exactly like what was originally
+ set but will be indentical in terms of keyword/value pairs. Security information
+ will not be included unless the Persist Security Info value is set to true.
+ </para>
+ <para>
+ You can use the <B>ConnectionString</B> property to connect to a database.
+ The following example illustrates a typical connection string.
+ </para>
+ <c>"Persist Security Info=False;database=MyDB;server=MySqlServer;user id=myUser;Password=myPass"</c>
+ <para>
+ The <B>ConnectionString</B> property can be set only when the connection is
+ closed. Many of the connection string values have corresponding read-only
+ properties. When the connection string is set, all of these properties are
+ updated, except when an error is detected. In this case, none of the properties
+ are updated. <see cref="MySqlConnection"/> properties return only those settings contained in the
+ <B>ConnectionString</B>.
+ </para>
+ <para>
+ To connect to a local machine, specify "localhost" for the server. If you do not
+ specify a server, localhost is assumed.
+ </para>
+ <para>
+ Resetting the <B>ConnectionString</B> on a closed connection resets all
+ connection string values (and related properties) including the password. For
+ example, if you set a connection string that includes "Database= MyDb", and
+ then reset the connection string to "Data Source=myserver;User Id=myUser;Password=myPass",
+ the <see cref="MySqlConnection.Database"/> property is no longer set to MyDb.
+ </para>
+ <para>
+ The connection string is parsed immediately after being set. If errors in
+ syntax are found when parsing, a runtime exception, such as <see cref="ArgumentException"/>,
+ is generated. Other errors can be found only when an attempt is made to open the
+ connection.
+ </para>
+ <para>
+ The basic format of a connection string consists of a series of keyword/value
+ pairs separated by semicolons. The equal sign (=) connects each keyword and its
+ value. To include values that contain a semicolon, single-quote character, or
+ double-quote character, the value must be enclosed in double quotes. If the
+ value contains both a semicolon and a double-quote character, the value can be
+ enclosed in single quotes. The single quote is also useful if the value begins
+ with a double-quote character. Conversely, the double quote can be used if the
+ value begins with a single quote. If the value contains both single-quote and
+ double-quote characters, the quote character used to enclose the value must be
+ doubled each time it occurs within the value.
+ </para>
+ <para>
+ To include preceding or trailing spaces in the string value, the value must
+ be enclosed in either single quotes or double quotes. Any leading or trailing
+ spaces around integer, Boolean, or enumerated values are ignored, even if
+ enclosed in quotes. However, spaces within a string literal keyword or value are
+ preserved. Using .NET Framework version 1.1, single or double quotes may be used
+ within a connection string without using delimiters (for example, Data Source=
+ my'Server or Data Source= my"Server), unless a quote character is the first or
+ last character in the value.
+ </para>
+ <para>
+ To include an equal sign (=) in a keyword or value, it must be preceded by
+ another equal sign. For example, in the hypothetical connection string
+ </para>
+ <c>"key==word=value"</c>
+ <para></para>
+ <para>the keyword is "key=word" and the value is "value".</para>
+ <para>
+ If a specific keyword in a keyword= value pair occurs multiple times in a
+ connection string, the last occurrence listed is used in the value set.
+ </para>
+ <para>Keywords are not case sensitive.</para>
+ <para>
+ The following table lists the valid names for keyword values within the
+ <B>ConnectionString</B>.
+ </para>
+
+ <div class="tablediv">
+ <table class="dtTABLE" cellspacing="0">
+ <tr valign="top">
+ <th width="33%">Name</th>
+ <th width="33%">Default</th>
+ <th width="33%">Description</th>
+ </tr>
+ <tr>
+ <td>
+ Connect Timeout<para> -or- </para>Connection Timeout
+ </td>
+ <td>15</td>
+ <td>
+ The length of time (in seconds) to wait for a connection to the server before
+ terminating the attempt and generating an error.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Host<para> -or- </para>Server<para> -or- </para>Data Source<para> -or- </para>
+ DataSource<para> -or- </para>Address<para> -or- </para>Addr<para> -or- </para>
+ Network Address
+ </td>
+ <td>localhost</td>
+ <td>
+ <para>
+ The name or network address of the instance of MySQL to which to connect. Multiple hosts can be
+ specified separated by &. This can be useful where multiple MySQL servers are configured for replication
+ and you are not concerned about the precise server you are connecting to. No attempt is made by the provider to
+ synchronize writes to the database so care should be taken when using this option.
+ </para>
+ <para>
+ 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.
+ Currently only a single socket name can be given so accessing MySQL in a replicated environment using Unix sockets is not currently supported.
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>Port</td>
+ <td>3306</td>
+ <td>
+ The port MySQL is using to listen for connections. Specify -1 for this value to use a
+ named pipe connection (Windows only). This value is ignored if Unix socket is used.
+ </td>
+ </tr>
+ <tr>
+ <td>Protocol</td>
+ <td>socket</td>
+ <td>
+ Specifies the type of connection to make to the server.<para>Values can be:</para>
+ socket or tcp for a socket connection<br/>
+ pipe for a named pipe connection<br/>
+ unix for a Unix socket connection<br/>
+ memory to use MySQL shared memory
+ </td>
+ </tr>
+ <tr>
+ <td>
+ CharSet<para> -or </para>Character Set
+ </td>
+ <td></td>
+ <td>
+ Specifies the character set that should be used to encode all queries sent to the server.
+ Resultsets are still returned in the character set of the data returned.
+ </td>
+ </tr>
+ <tr>
+ <td>Logging</td>
+ <td>false</td>
+ <td>When true, various pieces of information is output to any configured TraceListeners.</td>
+ </tr>
+ <tr>
+ <td>Allow Batch</td>
+ <td>true</td>
+ <td>
+ When true, multiple SQL statements can be sent with one command execution.<br/><br/>
+ -Note-<br/>
+ Starting with MySQL 4.1.1, batch statements should be separated by the server-defined seperator character.<br/>
+ Commands sent to earlier versions of MySQL should be seperated with ';'.
+ </td>
+ </tr>
+ <tr>
+ <td>Encrypt</td>
+ <td>false</td>
+ <td>
+ When <B>true</B>, SSL/TLS encryption is used for all data sent between the
+ client and server if the server has a certificate installed. Recognized values
+ are <B>true</B>, <B>false</B>, <B>yes</B>, and <B>no</B>.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Initial Catalog<para> -or- </para>Database
+ </td>
+ <td>mysql</td>
+ <td>The name of the database to use intially</td>
+ </tr>
+ <tr>
+ <td>
+ Password<para> -or- </para>pwd
+ </td>
+ <td></td>
+ <td>The password for the MySQL account being used.</td>
+ </tr>
+ <tr>
+ <td>Persist Security Info</td>
+ <td>false</td>
+ <td>
+ When set to <B>false</B> or <B>no</B> (strongly recommended), security-sensitive
+ information, such as the password, is not returned as part of the connection if
+ the connection is open or has ever been in an open state. Resetting the
+ connection string resets all connection string values including the password.
+ Recognized values are <B>true</B>, <B>false</B>, <B>yes</B>, and <B>no</B>.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ User Id<para> -or- </para>Username<para> -or- </para>Uid<para> -or- </para>User name
+ </td>
+ <td></td>
+ <td>The MySQL login account being used.</td>
+ </tr>
+ <tr>
+ <td>Shared Memory Name</td>
+ <td>MYSQL</td>
+ <td>The name of the shared memory object to use for communication if the connection protocol is set to memory.</td>
+ </tr>
+ <tr>
+ <td>Allow Zero Datetime</td>
+ <td>false</td>
+ <td>
+ True to have MySqlDataReader.GetValue() return a MySqlDateTime for date or datetime columns that have illegal values.
+ False will cause a DateTime object to be returned for legal values and an exception will be thrown for illegal values.
+ </td>
+ </tr>
+ <tr>
+ <td>Convert Zero Datetime</td>
+ <td>false</td>
+ <td>
+ True to have MySqlDataReader.GetValue() and MySqlDataReader.GetDateTime()
+ return DateTime.MinValue for date or datetime columns that have illegal values.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Old Syntax<para> -or- </para>OldSyntax
+ </td>
+ <td>false</td>
+ <td>
+ Allows use of '@' symbol as a parameter marker. See <see cref="MySqlCommand"/> for more
+ info.
+ <note>
+ This is for compatibility only. All future code should be written to
+ use the new '?' parameter marker.
+ </note>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Pipe Name<para> -or- </para>Pipe
+ </td>
+ <td>mysql</td>
+ <td>
+ When set to the name of a named pipe, the <B>MySqlConnection</B> will attempt to connect to MySQL
+ on that named pipe.<br/><br/>This settings only applies to the Windows platform.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Use Performance Monitor<para> -or- </para>UsePerformanceMonitor
+ </td>
+ <td>false</td>
+ <td>
+ Posts performance data that can be tracked using perfmon
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Procedure Cache Size
+ </td>
+ <td>25</td>
+ <td>
+ How many stored procedure definitions can be held in the cache
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Ignore Prepare
+ </td>
+ <td>true</td>
+ <td>
+ Instructs the provider to ignore any attempts to prepare commands. This option
+ was added to allow a user to disable prepared statements in an entire application
+ without modifying the code. A user might want to do this if errors or bugs are
+ encountered with MySQL prepared statements.
+ </td>
+ </tr>
+ <tr>
+ <td>Use Procedure Bodies</td>
+ <td>true</td>
+ <td>
+ Instructs the provider to attempt to call the procedure without first resolving the metadata. Thjis
+ is useful in situations where the calling user does not have access to the mysql.proc table. To
+ use this mode, the parameters for the procedure must be added to the command in the same order
+ as they appear in the procedure definition and their types must be explicitly set.
+ </td>
+ </tr>
+ <tr>
+ <td>Auto Enlist</td>
+ <td>true</td>
+ <td>
+ Indicates whether the connection should automatically enlist in the current transaction,
+ if there is one.
+ </td>
+ </tr>
+ <tr>
+ <td>Respect Binary Flags</td>
+ <td>true</td>
+ <td>
+ Indicates whether the connection should respect all binary flags sent to the client
+ as part of column metadata. False will cause the connector to behave like
+ Connector/Net 5.0 and earlier.
+ </td>
+ </tr>
+ <tr>
+ <td>BlobAsUTF8IncludePattern</td>
+ <td>null</td>
+ <td>
+ Pattern that should be used to indicate which blob columns should be treated as UTF-8.
+ </td>
+ </tr>
+ <tr>
+ <td>BlobAsUTF8ExcludePattern</td>
+ <td>null</td>
+ <td>
+ Pattern that should be used to indicate which blob columns should not be treated as UTF-8.
+ </td>
+ </tr>
+ </table>
+ </div>
+ <para>
+ The following table lists the valid names for connection pooling values within
+ the <B>ConnectionString</B>. For more information about connection pooling, see
+ Connection Pooling for the MySql Data Provider.
+ </para>
+ <div class="tablediv">
+ <table class="dtTABLE" cellspacing="0">
+ <tr valign="top">
+ <th width="33%">Name</th>
+ <th width="33%">Default</th>
+ <th width="33%">Description</th>
+ </tr>
+ <tr>
+ <td>Connection Lifetime</td>
+ <td>0</td>
+ <td>
+ When a connection is returned to the pool, its creation time is compared with
+ the current time, and the connection is destroyed if that time span (in seconds)
+ exceeds the value specified by <B>Connection Lifetime</B>. This is useful in
+ clustered configurations to force load balancing between a running server and a
+ server just brought online.
+ <para>
+ A value of zero (0) causes pooled connections to have the maximum connection
+ timeout.
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>Max Pool Size</td>
+ <td>100</td>
+ <td>The maximum number of connections allowed in the pool.</td>
+ </tr>
+ <tr>
+ <td>Min Pool Size</td>
+ <td>0</td>
+ <td>The minimum number of connections allowed in the pool.</td>
+ </tr>
+ <tr>
+ <td>Pooling</td>
+ <td>true</td>
+ <td>
+ When <B>true</B>, the <B>MySqlConnection</B> object is drawn from the appropriate
+ pool, or if necessary, is created and added to the appropriate pool. Recognized
+ values are <B>true</B>, <B>false</B>, <B>yes</B>, and <B>no</B>.
+ </td>
+ </tr>
+ <tr>
+ <td>Connection Reset</td>
+ <td>false</td>
+ <td>
+ Specifies whether the database connection should be reset when being
+ drawn from the pool. Leaving this as <b>false</b> will yeild much faster
+ connection opens but the user should understand the side effects
+ of doing this such as temporary tables and user variables from the previous
+ session not being cleared out.
+ </td>
+ </tr>
+ </table>
+ </div>
+ <para>
+ When setting keyword or connection pooling values that require a Boolean
+ value, you can use 'yes' instead of 'true', and 'no' instead of 'false'.
+ </para>
+ <para>
+ <B>Note</B> The MySql Data Provider uses the native socket protocol to
+ communicate with MySQL. Therefore, it does not support the use of an ODBC data source name (DSN) when
+ connecting to MySQL because it does not add an ODBC layer.
+ </para>
+ <para>
+ <B>CAUTION</B> In this release, the application should use caution when constructing a
+ connection string based on user input (for example when retrieving user ID and password information from a
+ dialog box, and appending it to the connection string). The application should
+ ensure that a user cannot embed extra connection string parameters in these
+ values (for example, entering a password as "validpassword;database=somedb" in
+ an attempt to attach to a different database).
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlConnection"/> and sets some of its properties
+ <code lang="vbnet">
+ Public Sub CreateConnection()
+ Dim myConnection As New MySqlConnection()
+ myConnection.ConnectionString = "Persist Security Info=False;database=myDB;server=myHost;Connect Timeout=30;user id=myUser; pwd=myPass"
+ myConnection.Open()
+ End Sub 'CreateConnection
+ </code>
+ <code lang="C#">
+ public void CreateConnection()
+ {
+ MySqlConnection myConnection = new MySqlConnection();
+ myConnection.ConnectionString = "Persist Security Info=False;database=myDB;server=myHost;Connect Timeout=30;user id=myUser; pwd=myPass";
+ myConnection.Open();
+ }
+ </code>
+ </example>
+ <example>
+ The following example creates a <see cref="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.
+ <code lang="vbnet">
+ Public Sub CreateConnection()
+ Dim myConnection As New MySqlConnection()
+ myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass"
+ myConnection.Open()
+ End Sub 'CreateConnection
+ </code>
+ <code lang="C#">
+ public void CreateConnection()
+ {
+ MySqlConnection myConnection = new MySqlConnection();
+ myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass";
+ myConnection.Open();
+ }
+ </code>
+ </example>
+ </ConnectionString>
</docs>
Modified: branches/5.1/Driver/Source/docs/MySqlConnectionStringBuilder.xml
===================================================================
--- branches/5.1/Driver/Source/docs/MySqlConnectionStringBuilder.xml 2007-11-01 20:58:53 UTC (rev 1054)
+++ branches/5.1/Driver/Source/docs/MySqlConnectionStringBuilder.xml 2007-11-02 21:13:58 UTC (rev 1055)
@@ -18,7 +18,7 @@
when the connection is first opened.
</summary>
<remarks>
- There is no default for this property and, if not set, the
+ There is no default for this property and, if not set, the
connection will not have a current database until one is set
using the <see cref="ChangeDatabase"/> method.
</remarks>
@@ -50,6 +50,6 @@
<example>
</example>
</PipeName>
-
+
</docs>
\ No newline at end of file
Modified: branches/5.1/Driver/Source/docs/MySqlDataAdapter.xml
===================================================================
--- branches/5.1/Driver/Source/docs/MySqlDataAdapter.xml 2007-11-01 20:58:53 UTC (rev 1054)
+++ branches/5.1/Driver/Source/docs/MySqlDataAdapter.xml 2007-11-02 21:13:58 UTC (rev 1055)
@@ -1,723 +1,800 @@
<docs>
-<class>
- <summary>
- 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.
- </summary>
-<remarks>
- <para>
- The <B>MySQLDataAdapter</B>, serves as a bridge between a <see cref="System.Data.DataSet"/>
- and MySQL for retrieving and saving data. The <B>MySQLDataAdapter</B> provides this
- bridge by mapping <see cref="DbDataAdapter.Fill(DataSet)"/>, which changes the data in the
- <B>DataSet</B> to match the data in the data source, and <see cref="System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/>,
- which changes the data in the data source to match the data in the <B>DataSet</B>,
- using the appropriate SQL statements against the data source.
- </para>
- <para>
- When the <B>MySQLDataAdapter</B> fills a <B>DataSet</B>, it will create the necessary
- tables and columns for the returned data if they do not already exist. However, primary
- key information will not be included in the implicitly created schema unless the
- <see cref="System.Data.MissingSchemaAction"/> property is set to <see cref="System.Data.MissingSchemaAction.AddWithKey"/>.
- You may also have the <B>MySQLDataAdapter</B> create the schema of the <B>DataSet</B>,
- including primary key information, before filling it with data using <see cref="System.Data.Common.DbDataAdapter.FillSchema(DataTable, SchemaType)"/>.
- </para>
- <para><B>MySQLDataAdapter</B> is used in conjunction with <see cref="MySqlConnection"/>
- and <see cref="MySqlCommand"/> to increase performance when connecting to a MySQL database.
- </para>
- <para>The <B>MySQLDataAdapter</B> also includes the <see cref="MySqlDataAdapter.SelectCommand"/>,
- <see cref="MySqlDataAdapter.InsertCommand"/>, <see cref="MySqlDataAdapter.DeleteCommand"/>,
- <see cref="MySqlDataAdapter.UpdateCommand"/>, and <see cref="DataAdapter.TableMappings"/>
- properties to facilitate the loading and updating of data.
- </para>
- <para>When an instance of <B>MySQLDataAdapter</B> is created, the read/write properties
- are set to initial values. For a list of these values, see the <B>MySQLDataAdapter</B>
- constructor.
- </para>
- <note>
- Please be aware that the <see cref="DataColumn"/> class in .NET 1.0 and 1.1 does not allow columns
- with type of UInt16, UInt32, or UInt64 to be autoincrement columns. If you plan to use autoincremement
- columns with MySQL, you should consider using signed integer columns.
- </note>
-</remarks>
+ <class>
+ <summary>
+ 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.
+ </summary>
+ <remarks>
+ <para>
+ The <B>MySQLDataAdapter</B>, serves as a bridge between a <see cref="System.Data.DataSet"/>
+ and MySQL for retrieving and saving data. The <B>MySQLDataAdapter</B> provides this
+ bridge by mapping <see cref="DbDataAdapter.Fill(DataSet)"/>, which changes the data in the
+ <B>DataSet</B> to match the data in the data source, and <see cref="System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/>,
+ which changes the data in the data source to match the data in the <B>DataSet</B>,
+ using the appropriate SQL statements against the data source.
+ </para>
+ <para>
+ When the <B>MySQLDataAdapter</B> fills a <B>DataSet</B>, it will create the necessary
+ tables and columns for the returned data if they do not already exist. However, primary
+ key information will not be included in the implicitly created schema unless the
+ <see cref="System.Data.MissingSchemaAction"/> property is set to <see cref="System.Data.MissingSchemaAction.AddWithKey"/>.
+ You may also have the <B>MySQLDataAdapter</B> create the schema of the <B>DataSet</B>,
+ including primary key information, before filling it with data using <see cref="System.Data.Common.DbDataAdapter.FillSchema(DataTable, SchemaType)"/>.
+ </para>
+ <para>
+ <B>MySQLDataAdapter</B> is used in conjunction with <see cref="MySqlConnection"/>
+ and <see cref="MySqlCommand"/> to increase performance when connecting to a MySQL database.
+ </para>
+ <para>
+ The <B>MySQLDataAdapter</B> also includes the <see cref="MySqlDataAdapter.SelectCommand"/>,
+ <see cref="MySqlDataAdapter.InsertCommand"/>, <see cref="MySqlDataAdapter.DeleteCommand"/>,
+ <see cref="MySqlDataAdapter.UpdateCommand"/>, and <see cref="DataAdapter.TableMappings"/>
+ properties to facilitate the loading and updating of data.
+ </para>
+ <para>
+ When an instance of <B>MySQLDataAdapter</B> is created, the read/write properties
+ are set to initial values. For a list of these values, see the <B>MySQLDataAdapter</B>
+ constructor.
+ </para>
+ <note>
+ Please be aware that the <see cref="DataColumn"/> class in .NET 1.0 and 1.1 does not allow columns
+ with type of UInt16, UInt32, or UInt64 to be autoincrement columns. If you plan to use autoincremement
+ columns with MySQL, you should consider using signed integer columns.
+ </note>
+ </remarks>
-<example>
- The following example creates a <see cref="MySqlCommand"/> and a <see cref="MySqlConnection"/>.
- The <B>MySqlConnection</B> is opened and set as the <see cref="MySqlCommand.Connection"/> for the
- <B>MySqlCommand</B>. The example then calls <see cref="MySqlCommand.ExecuteNonQuery"/>, and closes
- the connection. To accomplish this, the <B>ExecuteNonQuery</B> is
- passed a connection string and a query string that is a SQL INSERT
- statement.
- <code lang="Visual Basic">
-Public Function SelectRows(dataSet As DataSet, connection As String, query As String) As DataSet
- Dim conn As New MySqlConnection(connection)
- Dim adapter As New MySqlDataAdapter()
- adapter.SelectCommand = new MySqlCommand(query, conn)
- adapter.Fill(dataset)
- Return dataset
-End Function
- </code>
- <code lang="C#">
-public DataSet SelectRows(DataSet dataset,string connection,string query)
-{
- MySqlConnection conn = new MySqlConnection(connection);
- MySqlDataAdapter adapter = new MySqlDataAdapter();
- adapter.SelectCommand = new MySqlCommand(query, conn);
- adapter.Fill(dataset);
- return dataset;
-}
- </code>
-</example>
-</class>
+ <example>
+ The following example creates a <see cref="MySqlCommand"/> and a <see cref="MySqlConnection"/>.
+ The <B>MySqlConnection</B> is opened and set as the <see cref="MySqlCommand.Connection"/> for the
+ <B>MySqlCommand</B>. The example then calls <see cref="MySqlCommand.ExecuteNonQuery"/>, and closes
+ the connection. To accomplish this, the <B>ExecuteNonQuery</B> is
+ passed a connection string and a query string that is a SQL INSERT
+ statement.
+ <code lang="vbnet">
+ Public Function SelectRows(dataSet As DataSet, connection As String, query As String) As DataSet
+ Dim conn As New MySqlConnection(connection)
+ Dim adapter As New MySqlDataAdapter()
+ adapter.SelectCommand = new MySqlCommand(query, conn)
+ adapter.Fill(dataset)
+ Return dataset
+ End Function
+ </code>
+ <code lang="C#">
+ public DataSet SelectRows(DataSet dataset,string connection,string query)
+ {
+ MySqlConnection conn = new MySqlConnection(connection);
+ MySqlDataAdapter adapter = new MySqlDataAdapter();
+ adapter.SelectCommand = new MySqlCommand(query, conn);
+ adapter.Fill(dataset);
+ return dataset;
+ }
+ </code>
+ </example>
+ </class>
-<Ctor>
- <overloads></overloads>
- <summary>
- Initializes a new instance of the MySqlDataAdapter class.
- </summary>
- <remarks>
- <para>
- When an instance of <see cref="MySqlDataAdapter"/> is created,
- the following read/write properties are set to the following initial
- values.
- </para>
- <list type="table">
- <listheader><term>Properties</term><term>Initial Value</term></listheader>
- <item><term><see cref="MissingMappingAction"/></term><term><B>MissingMappingAction.Passthrough</B></term></item>
- <item><term><see cref="MissingSchemaAction"/></term><term><B>MissingSchemaAction.Add</B></term></item>
- </list>
- <para>
- You can change the value of any of these properties through a separate call
- to the property.
- </para>
- </remarks>
- <example>
-The following example creates a <see cref="MySqlDataAdapter"/> and sets some of
-its properties.
-<code lang="Visual Basic">
-Public Sub CreateSqlDataAdapter()
- Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _
- "database=test")
- Dim da As MySqlDataAdapter = New MySqlDataAdapter
- da.MissingSchemaAction = MissingSchemaAction.AddWithKey
-
- da.SelectCommand = New MySqlCommand("SELECT id, name FROM mytable", conn)
- da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
- "VALUES (?id, ?name)", conn)
- da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=?id, name=?name " & _
- "WHERE id=?oldId", conn)
- da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
+ <Ctor>
+ <overloads></overloads>
+ <summary>
+ Initializes a new instance of the MySqlDataAdapter class.
+ </summary>
+ <remarks>
+ <para>
+ When an instance of <see cref="MySqlDataAdapter"/> is created,
+ the following read/write properties are set to the following initial
+ values.
+ </para>
+ <list type="table">
+ <listheader>
+ <term>Properties</term>
+ <term>Initial Value</term>
+ </listheader>
+ <item>
+ <term>
+ <see cref="MissingMappingAction"/>
+ </term>
+ <term>
+ <B>MissingMappingAction.Passthrough</B>
+ </term>
+ </item>
+ <item>
+ <term>
+ <see cref="MissingSchemaAction"/>
+ </term>
+ <term>
+ <B>MissingSchemaAction.Add</B>
+ </term>
+ </item>
+ </list>
+ <para>
+ You can change the value of any of these properties through a separate call
+ to the property.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlDataAdapter"/> and sets some of
+ its properties.
+ <code lang="vbnet">
+ Public Sub CreateSqlDataAdapter()
+ Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _
+ "database=test")
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey
- da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
- da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
-
- da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
- da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
- da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+ da.SelectCommand = New MySqlCommand("SELECT id, name FROM mytable", conn)
+ da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
+ "VALUES (?id, ?name)", conn)
+ da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=?id, name=?name " & _
+ "WHERE id=?oldId", conn)
+ da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
- da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
-End Sub
-</code>
-<code lang="C#">
-public static void CreateSqlDataAdapter()
-{
- MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test");
- MySqlDataAdapter da = new MySqlDataAdapter();
- da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
-
- da.SelectCommand = new MySqlCommand("SELECT id, name FROM mytable", conn);
- da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
- "VALUES (?id, ?name)", conn);
- da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=?id, name=?name " +
- "WHERE id=?oldId", conn);
- da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
+ da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
+ da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
- da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
- da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
-
- da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
- da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
- da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+ da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
+ da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
+ da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
- da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
-}
-</code>
- </example>
-</Ctor>
+ da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+ End Sub
+ </code>
+ <code lang="C#">
+ public static void CreateSqlDataAdapter()
+ {
+ MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test");
+ MySqlDataAdapter da = new MySqlDataAdapter();
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
-<Ctor1>
- <summary>
- Initializes a new instance of the <see cref="MySqlDataAdapter"/> class with
- the specified <see cref="MySqlCommand"/> as the <see cref="SelectCommand"/>
- property.
- </summary>
- <param name="selectCommand">
- <see cref="MySqlCommand"/> that is a SQL SELECT statement or stored procedure and is set
- as the <see cref="SelectCommand"/> property of the <see cref="MySqlDataAdapter"/>.
- </param>
- <remarks>
- <para>
- When an instance of <see cref="MySqlDataAdapter"/> is created,
- the following read/write properties are set to the following initial
- values.
- </para>
- <list type="table">
- <listheader><term>Properties</term><term>Initial Value</term></listheader>
- <item><term><see cref="MissingMappingAction"/></term><term><B>MissingMappingAction.Passthrough</B></term></item>
- <item><term><see cref="MissingSchemaAction"/></term><term><B>MissingSchemaAction.Add</B></term></item>
- </list>
- <para>
- You can change the value of any of these properties through a separate call
- to the property.
- </para>
- <para>
- When <B>SelectCommand</B> (or any of the other command properties) is assigned
- to a previously created <see cref="MySqlCommand"/>, the <B>MySqlCommand</B> is not cloned.
- The <B>SelectCommand</B> maintains a reference to the previously created <B>MySqlCommand</B>
- object.
- </para>
- </remarks>
- <example>
-The following example creates a <see cref="MySqlDataAdapter"/> and sets some of
-its properties.
-<code lang="Visual Basic">
-Public Sub CreateSqlDataAdapter()
- Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _
- "database=test")
- Dim cmd as new MySqlCommand("SELECT id, name FROM mytable", conn)
- Dim da As MySqlDataAdapter = New MySqlDataAdapter(cmd)
- da.MissingSchemaAction = MissingSchemaAction.AddWithKey
-
- da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
- "VALUES (?id, ?name)", conn)
- da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=?id, name=?name " & _
- "WHERE id=?oldId", conn)
- da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
+ da.SelectCommand = new MySqlCommand("SELECT id, name FROM mytable", conn);
+ da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
+ "VALUES (?id, ?name)", conn);
+ da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=?id, name=?name " +
+ "WHERE id=?oldId", conn);
+ da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
- da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
- da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
-
- da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
- da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
- da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+ da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
+ da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
- da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
-End Sub
-</code>
-<code lang="C#">
-public static void CreateSqlDataAdapter()
-{
- MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test");
- MySqlCommand cmd = new MySqlCommand("SELECT id, name FROM mytable", conn);
- MySqlDataAdapter da = new MySqlDataAdapter(cmd);
- da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
-
- da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
- "VALUES (?id, ?name)", conn);
- da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=?id, name=?name " +
- "WHERE id=?oldId", conn);
- da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
+ da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
+ da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
+ da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
- da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
- da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
-
- da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
- da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
- da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+ da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+ }
+ </code>
+ </example>
+ </Ctor>
- da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
-}
-</code>
- </example>
-</Ctor1>
+ <Ctor1>
+ <summary>
+ Initializes a new instance of the <see cref="MySqlDataAdapter"/> class with
+ the specified <see cref="MySqlCommand"/> as the <see cref="SelectCommand"/>
+ property.
+ </summary>
+ <param name="selectCommand">
+ <see cref="MySqlCommand"/> that is a SQL SELECT statement or stored procedure and is set
+ as the <see cref="SelectCommand"/> property of the <see cref="MySqlDataAdapter"/>.
+ </param>
+ <remarks>
+ <para>
+ When an instance of <see cref="MySqlDataAdapter"/> is created,
+ the following read/write properties are set to the following initial
+ values.
+ </para>
+ <list type="table">
+ <listheader>
+ <term>Properties</term>
+ <term>Initial Value</term>
+ </listheader>
+ <item>
+ <term>
+ <see cref="MissingMappingAction"/>
+ </term>
+ <term>
+ <B>MissingMappingAction.Passthrough</B>
+ </term>
+ </item>
+ <item>
+ <term>
+ <see cref="MissingSchemaAction"/>
+ </term>
+ <term>
+ <B>MissingSchemaAction.Add</B>
+ </term>
+ </item>
+ </list>
+ <para>
+ You can change the value of any of these properties through a separate call
+ to the property.
+ </para>
+ <para>
+ When <B>SelectCommand</B> (or any of the other command properties) is assigned
+ to a previously created <see cref="MySqlCommand"/>, the <B>MySqlCommand</B> is not cloned.
+ The <B>SelectCommand</B> maintains a reference to the previously created <B>MySqlCommand</B>
+ object.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlDataAdapter"/> and sets some of
+ its properties.
+ <code lang="vbnet">
+ Public Sub CreateSqlDataAdapter()
+ Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _
+ "database=test")
+ Dim cmd as new MySqlCommand("SELECT id, name FROM mytable", conn)
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter(cmd)
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey
-<Ctor2>
- <summary>
- Initializes a new instance of the <see cref="MySqlDataAdapter"/> class with
- a <see cref="SelectCommand"/> and a <see cref="MySqlConnection"/> object.
- </summary>
- <param name="selectCommandText">
- A <b>String</b> that is a SQL SELECT statement or stored procedure to be used by
- the <see cref="SelectCommand"/> property of the <see cref="MySqlDataAdapter"/>.
- </param>
- <param name="connection">A <see cref="MySqlConnection"/> that represents the connection.</param>
- <remarks>
- <para>
- This implementation of the <see cref="MySqlDataAdapter"/> opens and closes a <see cref="MySqlConnection"/>
- if it is not already open. This can be useful in a an application that must call the
- <see cref="DbDataAdapter.Fill(DataSet)"/> method for two or more <B>MySqlDataAdapter</B> objects.
- If the <B>MySqlConnection</B> is already open, you must explicitly call
- <see cref="MySqlConnection.Close"/> or <see cref="MySqlConnection.Dispose"/> to close it.
- </para>
- <para>
- When an instance of <see cref="MySqlDataAdapter"/> is created,
- the following read/write properties are set to the following initial
- values.
- </para>
- <list type="table">
- <listheader><term>Properties</term><term>Initial Value</term></listheader>
- <item><term><see cref="MissingMappingAction"/></term><term><B>MissingMappingAction.Passthrough</B></term></item>
- <item><term><see cref="MissingSchemaAction"/></term><term><B>MissingSchemaAction.Add</B></term></item>
- </list>
- <para>
- You can change the value of any of these properties through a separate call
- to the property.
- </para>
- </remarks>
- <example>
-The following example creates a <see cref="MySqlDataAdapter"/> and sets some of
-its properties.
-<code lang="Visual Basic">
-Public Sub CreateSqlDataAdapter()
- Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _
- "database=test")
- Dim da As MySqlDataAdapter = New MySqlDataAdapter("SELECT id, name FROM mytable", conn)
- da.MissingSchemaAction = MissingSchemaAction.AddWithKey
-
- da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
- "VALUES (?id, ?name)", conn)
- da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=?id, name=?name " & _
- "WHERE id=?oldId", conn)
- da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
+ da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
+ "VALUES (?id, ?name)", conn)
+ da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=?id, name=?name " & _
+ "WHERE id=?oldId", conn)
+ da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
- da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
- da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
-
- da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
- da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
- da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+ da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
+ da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
- da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
-End Sub
-</code>
-<code lang="C#">
-public static void CreateSqlDataAdapter()
-{
- MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test");
- MySqlDataAdapter da = new MySqlDataAdapter("SELECT id, name FROM mytable", conn);
- da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
-
- da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
- "VALUES (?id, ?name)", conn);
- da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=?id, name=?name " +
- "WHERE id=?oldId", conn);
- da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
+ da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
+ da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
+ da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
- da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
- da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
-
- da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
- da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
- da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+ da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+ End Sub
+ </code>
+ <code lang="C#">
+ public static void CreateSqlDataAdapter()
+ {
+ MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test");
+ MySqlCommand cmd = new MySqlCommand("SELECT id, name FROM mytable", conn);
+ MySqlDataAdapter da = new MySqlDataAdapter(cmd);
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
- da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
-}
-</code>
- </example>
-</Ctor2>
+ da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
+ "VALUES (?id, ?name)", conn);
+ da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=?id, name=?name " +
+ "WHERE id=?oldId", conn);
+ da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
-<Ctor3>
- <summary>
- Initializes a new instance of the <see cref="MySqlDataAdapter"/> class with
- a <see cref="SelectCommand"/> and a connection string.
- </summary>
- <param name="selectCommandText">
- A <see cref="string"/> that is a SQL SELECT statement or stored procedure to
- be used by the <see cref="SelectCommand"/> property of the <see cref="MySqlDataAdapter"/>.
- </param>
- <param name="selectConnString">The connection string</param>
- <remarks>
- <para>
- When an instance of <see cref="MySqlDataAdapter"/> is created,
- the following read/write properties are set to the following initial
- values.
- </para>
- <list type="table">
- <listheader><term>Properties</term><term>Initial Value</term></listheader>
- <item><term><see cref="MissingMappingAction"/></term><term><B>MissingMappingAction.Passthrough</B></term></item>
- <item><term><see cref="MissingSchemaAction"/></term><term><B>MissingSchemaAction.Add</B></term></item>
- </list>
- <para>
- You can change the value of any of these properties through a separate call
- to the property.
- </para>
- </remarks>
- <example>
-The following example creates a <see cref="MySqlDataAdapter"/> and sets some of
-its properties.
-<code lang="Visual Basic">
-Public Sub CreateSqlDataAdapter()
- Dim da As MySqlDataAdapter = New MySqlDataAdapter("SELECT id, name FROM mytable", "Data Source=localhost;database=test")
- Dim conn As MySqlConnection = da.SelectCommand.Connection
- da.MissingSchemaAction = MissingSchemaAction.AddWithKey
-
- da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
- "VALUES (?id, ?name)", conn)
- da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=?id, name=?name " & _
- "WHERE id=?oldId", conn)
- da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
+ da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
+ da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
- da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
- da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
-
- da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
- da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
- da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+ da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
+ da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
+ da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
- da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
-End Sub
-</code>
-<code lang="C#">
-public static void CreateSqlDataAdapter()
-{
- MySqlDataAdapter da = new MySqlDataAdapter("SELECT id, name FROM mytable", "Data Source=localhost;database=test");
- MySqlConnection conn = da.SelectCommand.Connection;
- da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
-
- da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
- "VALUES (?id, ?name)", conn);
- da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=?id, name=?name " +
- "WHERE id=?oldId", conn);
- da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
+ da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+ }
+ </code>
+ </example>
+ </Ctor1>
- da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
- da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
-
- da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
- da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
- da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+ <Ctor2>
+ <summary>
+ Initializes a new instance of the <see cref="MySqlDataAdapter"/> class with
+ a <see cref="SelectCommand"/> and a <see cref="MySqlConnection"/> object.
+ </summary>
+ <param name="selectCommandText">
+ A <b>String</b> that is a SQL SELECT statement or stored procedure to be used by
+ the <see cref="SelectCommand"/> property of the <see cref="MySqlDataAdapter"/>.
+ </param>
+ <param name="connection">
+ A <see cref="MySqlConnection"/> that represents the connection.
+ </param>
+ <remarks>
+ <para>
+ This implementation of the <see cref="MySqlDataAdapter"/> opens and closes a <see cref="MySqlConnection"/>
+ if it is not already open. This can be useful in a an application that must call the
+ <see cref="DbDataAdapter.Fill(DataSet)"/> method for two or more <B>MySqlDataAdapter</B> objects.
+ If the <B>MySqlConnection</B> is already open, you must explicitly call
+ <see cref="MySqlConnection.Close"/> or <see cref="MySqlConnection.Dispose"/> to close it.
+ </para>
+ <para>
+ When an instance of <see cref="MySqlDataAdapter"/> is created,
+ the following read/write properties are set to the following initial
+ values.
+ </para>
+ <list type="table">
+ <listheader>
+ <term>Properties</term>
+ <term>Initial Value</term>
+ </listheader>
+ <item>
+ <term>
+ <see cref="MissingMappingAction"/>
+ </term>
+ <term>
+ <B>MissingMappingAction.Passthrough</B>
+ </term>
+ </item>
+ <item>
+ <term>
+ <see cref="MissingSchemaAction"/>
+ </term>
+ <term>
+ <B>MissingSchemaAction.Add</B>
+ </term>
+ </item>
+ </list>
+ <para>
+ You can change the value of any of these properties through a separate call
+ to the property.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlDataAdapter"/> and sets some of
+ its properties.
+ <code lang="vbnet">
+ Public Sub CreateSqlDataAdapter()
+ Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _
+ "database=test")
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter("SELECT id, name FROM mytable", conn)
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey
- da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
-}
-</code>
- </example>
-</Ctor3>
+ da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
+ "VALUES (?id, ?name)", conn)
+ da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=?id, name=?name " & _
+ "WHERE id=?oldId", conn)
+ da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
-<DeleteCommand>
- <summary>
- Gets or sets a SQL statement or stored procedure used to delete records from the data set.
- </summary>
- <value>
- A <see cref="MySqlCommand"/> used during <see cref="System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/> to delete records in the
- database that correspond to deleted rows in the <see cref="DataSet"/>.
- </value>
- <remarks>
- <para>During <see cref="System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/>, if this property is not set and primary key information
- is present in the <see cref="DataSet"/>, the <B>DeleteCommand</B> can be generated
- automatically if you set the <see cref="SelectCommand"/> property and use the
- <see cref="MySqlCommandBuilder"/>. Then, any additional commands that you do not set are
- generated by the <B>MySqlCommandBuilder</B>. This generation logic requires key column
- information to be present in the <B>DataSet</B>.
- </para>
- <para>
- When <B>DeleteCommand</B> is assigned to a previously created <see cref="MySqlCommand"/>,
- the <B>MySqlCommand</B> is not cloned. The <B>DeleteCommand</B> maintains a reference
- to the previously created <B>MySqlCommand</B> object.
- </para>
- </remarks>
- <example>
-The following example creates a <see cref="MySqlDataAdapter"/> and sets the
-<see cref="SelectCommand"/> and <B>DeleteCommand</B> properties. It assumes you have already
-created a <see cref="MySqlConnection"/> object.
-<code lang="Visual Basic">
-Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
-
- Dim da As MySqlDataAdapter = New MySqlDataAdapter()
- Dim cmd As MySqlCommand
- Dim parm As MySqlParameter
+ da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
+ da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
- ' Create the SelectCommand.
- cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn)
+ da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
+ da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
+ da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
- cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15)
- cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15)
+ da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+ End Sub
+ </code>
+ <code lang="C#">
+ public static void CreateSqlDataAdapter()
+ {
+ MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test");
+ MySqlDataAdapter da = new MySqlDataAdapter("SELECT id, name FROM mytable", conn);
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
- da.SelectCommand = cmd
+ da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
+ "VALUES (?id, ?name)", conn);
+ da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=?id, name=?name " +
+ "WHERE id=?oldId", conn);
+ da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
- ' Create the DeleteCommand.
- cmd = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
+ da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
+ da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
- parm = cmd.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
- parm.SourceVersion = DataRowVersion.Original
+ da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
+ da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
+ da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
- da.DeleteCommand = cmd
+ da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+ }
+ </code>
+ </example>
+ </Ctor2>
- Return da
-End Function
-</code>
-<code lang="C#">
-public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
-{
- MySqlDataAdapter da = new MySqlDataAdapter();
- MySqlCommand cmd;
- MySqlParameter parm;
+ <Ctor3>
+ <summary>
+ Initializes a new instance of the <see cref="MySqlDataAdapter"/> class with
+ a <see cref="SelectCommand"/> and a connection string.
+ </summary>
+ <param name="selectCommandText">
+ A <see cref="string"/> that is a SQL SELECT statement or stored procedure to
+ be used by the <see cref="SelectCommand"/> property of the <see cref="MySqlDataAdapter"/>.
+ </param>
+ <param name="selectConnString">The connection string</param>
+ <remarks>
+ <para>
+ When an instance of <see cref="MySqlDataAdapter"/> is created,
+ the following read/write properties are set to the following initial
+ values.
+ </para>
+ <list type="table">
+ <listheader>
+ <term>Properties</term>
+ <term>Initial Value</term>
+ </listheader>
+ <item>
+ <term>
+ <see cref="MissingMappingAction"/>
+ </term>
+ <term>
+ <B>MissingMappingAction.Passthrough</B>
+ </term>
+ </item>
+ <item>
+ <term>
+ <see cref="MissingSchemaAction"/>
+ </term>
+ <term>
+ <B>MissingSchemaAction.Add</B>
+ </term>
+ </item>
+ </list>
+ <para>
+ You can change the value of any of these properties through a separate call
+ to the property.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlDataAdapter"/> and sets some of
+ its properties.
+ <code lang="vbnet">
+ Public Sub CreateSqlDataAdapter()
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter("SELECT id, name FROM mytable", "Data Source=localhost;database=test")
+ Dim conn As MySqlConnection = da.SelectCommand.Connection
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey
- // Create the SelectCommand.
- cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn);
+ da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
+ "VALUES (?id, ?name)", conn)
+ da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=?id, name=?name " & _
+ "WHERE id=?oldId", conn)
+ da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
- cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15);
- cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15);
+ da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
+ da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
- da.SelectCommand = cmd;
+ da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
+ da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name")
+ da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
- // Create the DeleteCommand.
- cmd = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
+ da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+ End Sub
+ </code>
+ <code lang="C#">
+ public static void CreateSqlDataAdapter()
+ {
+ MySqlDataAdapter da = new MySqlDataAdapter("SELECT id, name FROM mytable", "Data Source=localhost;database=test");
+ MySqlConnection conn = da.SelectCommand.Connection;
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
- parm = cmd.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
- parm.SourceVersion = DataRowVersion.Original;
+ da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
+ "VALUES (?id, ?name)", conn);
+ da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=?id, name=?name " +
+ "WHERE id=?oldId", conn);
+ da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
- da.DeleteCommand = cmd;
+ da.InsertCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
+ da.InsertCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
- return da;
-}
-</code>
- </example>
-</DeleteCommand>
+ da.UpdateCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
+ da.UpdateCommand.Parameters.Add("?name", MySqlDbType.VarChar, 40, "name");
+ da.UpdateCommand.Parameters.Add("?oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
-<InsertCommand>
- <summary>
- Gets or sets a SQL statement or stored procedure used to insert records into the data set.
- </summary>
- <value>
- A <see cref="MySqlCommand"/> used during <see cref="System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/> to insert records into the
- database that correspond to new rows in the <see cref="DataSet"/>.
- </value>
- <remarks>
- <para>During <see cref="System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/>, if this property is not set and primary key information
- is present in the <see cref="DataSet"/>, the <B>InsertCommand</B> can be generated
- automatically if you set the <see cref="SelectCommand"/> property and use the
- <see cref="MySqlCommandBuilder"/>. Then, any additional commands that you do not set are
- generated by the <B>MySqlCommandBuilder</B>. This generation logic requires key column
- information to be present in the <B>DataSet</B>.
- </para>
- <para>
- When <B>InsertCommand</B> is assigned to a previously created <see cref="MySqlCommand"/>,
- the <B>MySqlCommand</B> is not cloned. The <B>InsertCommand</B> maintains a reference
- to the previously created <B>MySqlCommand</B> object.
- </para>
- <note>
- If execution of this command returns rows, these rows may be added to the <B>DataSet</B>
- depending on how you set the <see cref="MySqlCommand.UpdatedRowSource"/> property of the <B>MySqlCommand</B> object.
- </note>
- </remarks>
- <example>
-The following example creates a <see cref="MySqlDataAdapter"/> and sets the
-<see cref="SelectCommand"/> and <B>InsertCommand</B> properties. It assumes you have already
-created a <see cref="MySqlConnection"/> object.
-<code lang="Visual Basic">
-Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
-
- Dim da As MySqlDataAdapter = New MySqlDataAdapter()
- Dim cmd As MySqlCommand
- Dim parm As MySqlParameter
+ da.DeleteCommand.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+ }
+ </code>
+ </example>
+ </Ctor3>
- ' Create the SelectCommand.
- cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn)
+ <DeleteCommand>
+ <summary>
+ Gets or sets a SQL statement or stored procedure used to delete records from the data set.
+ </summary>
+ <value>
+ A <see cref="MySqlCommand"/> used during <see cref="System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/> to delete records in the
+ database that correspond to deleted rows in the <see cref="DataSet"/>.
+ </value>
+ <remarks>
+ <para>
+ During <see cref="System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/>, if this property is not set and primary key information
+ is present in the <see cref="DataSet"/>, the <B>DeleteCommand</B> can be generated
+ automatically if you set the <see cref="SelectCommand"/> property and use the
+ <see cref="MySqlCommandBuilder"/>. Then, any additional commands that you do not set are
+ generated by the <B>MySqlCommandBuilder</B>. This generation logic requires key column
+ information to be present in the <B>DataSet</B>.
+ </para>
+ <para>
+ When <B>DeleteCommand</B> is assigned to a previously created <see cref="MySqlCommand"/>,
+ the <B>MySqlCommand</B> is not cloned. The <B>DeleteCommand</B> maintains a reference
+ to the previously created <B>MySqlCommand</B> object.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlDataAdapter"/> and sets the
+ <see cref="SelectCommand"/> and <B>DeleteCommand</B> properties. It assumes you have already
+ created a <see cref="MySqlConnection"/> object.
+ <code lang="vbnet">
+ Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
- cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15)
- cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15)
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter()
+ Dim cmd As MySqlCommand
+ Dim parm As MySqlParameter
- da.SelectCommand = cmd
+ ' Create the SelectCommand.
+ cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn)
- ' Create the InsertCommand.
- cmd = New MySqlCommand("INSERT INTO mytable (id,name) VALUES (?id, ?name)", conn)
+ cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15)
+ cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15)
- cmd.Parameters.Add( "?id", MySqlDbType.VarChar, 15, "id" )
- cmd.Parameters.Add( "?name", MySqlDbType.VarChar, 15, "name" )
- da.InsertCommand = cmd
-
- Return da
-End Function
-</code>
-<code lang="C#">
-public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
-{
- MySqlDataAdapter da = new MySqlDataAdapter();
- MySqlCommand cmd;
- MySqlParameter parm;
+ da.SelectCommand = cmd
- // Create the SelectCommand.
- cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn);
+ ' Create the DeleteCommand.
+ cmd = New MySqlCommand("DELETE FROM mytable WHERE id=?id", conn)
- cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15);
- cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15);
+ parm = cmd.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id")
+ parm.SourceVersion = DataRowVersion.Original
- da.SelectCommand = cmd;
+ da.DeleteCommand = cmd
- // Create the InsertCommand.
- cmd = new MySqlCommand("INSERT INTO mytable (id,name) VALUES (?id,?name)", conn);
- cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15, "id" );
- cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15, "name" );
-
- da.InsertCommand = cmd;
+ Return da
+ End Function
+ </code>
+ <code lang="C#">
+ public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
+ {
+ MySqlDataAdapter da = new MySqlDataAdapter();
+ MySqlCommand cmd;
+ MySqlParameter parm;
- return da;
-}
-</code>
- </example>
-</InsertCommand>
+ // Create the SelectCommand.
+ cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn);
-<UpdateCommand>
- <summary>
- Gets or sets a SQL statement or stored procedure used to updated records in the data source.
- </summary>
- <value>
- A <see cref="MySqlCommand"/> used during <see cref="System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/> to update records in the
- database with data from the <see cref="DataSet"/>.
- </value>
- <remarks>
- <para>During <see cref="System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/>, if this property is not set and primary key information
- is present in the <see cref="DataSet"/>, the <B>UpdateCommand</B> can be generated
- automatically if you set the <see cref="SelectCommand"/> property and use the
- <see cref="MySqlCommandBuilder"/>. Then, any additional commands that you do not set are
- generated by the <B>MySqlCommandBuilder</B>. This generation logic requires key column
- information to be present in the <B>DataSet</B>.
- </para>
- <para>
- When <B>UpdateCommand</B> is assigned to a previously created <see cref="MySqlCommand"/>,
- the <B>MySqlCommand</B> is not cloned. The <B>UpdateCommand</B> maintains a reference
- to the previously created <B>MySqlCommand</B> object.
- </para>
- <note>
- If execution of this command returns rows, these rows may be merged with the DataSet
- depending on how you set the <see cref="MySqlCommand.UpdatedRowSource"/> property of the <B>MySqlCommand</B> object.
- </note>
- </remarks>
- <example>
-The following example creates a <see cref="MySqlDataAdapter"/> and sets the
-<see cref="SelectCommand"/> and <B>UpdateCommand</B> properties. It assumes you have already
-created a <see cref="MySqlConnection"/> object.
-<code lang="Visual Basic">
-Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
-
- Dim da As MySqlDataAdapter = New MySqlDataAdapter()
- Dim cmd As MySqlCommand
- Dim parm As MySqlParameter
+ cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15);
+ cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15);
- ' Create the SelectCommand.
- cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn)
+ da.SelectCommand = cmd;
- cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15)
- cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15)
+ // Create the DeleteCommand.
+ cmd = new MySqlCommand("DELETE FROM mytable WHERE id=?id", conn);
- da.SelectCommand = cmd
+ parm = cmd.Parameters.Add("?id", MySqlDbType.VarChar, 5, "id");
+ parm.SourceVersion = DataRowVersion.Original;
- ' Create the UpdateCommand.
- cmd = New MySqlCommand("UPDATE mytable SET id=?id, name=?name WHERE id=?oldId", conn)
+ da.DeleteCommand = cmd;
- cmd.Parameters.Add( "?id", MySqlDbType.VarChar, 15, "id" )
- cmd.Parameters.Add( "?name", MySqlDbType.VarChar, 15, "name" )
-
- parm = cmd.Parameters.Add("?oldId", MySqlDbType.VarChar, 15, "id")
- parm.SourceVersion = DataRowVersion.Original
-
- da.UpdateCommand = cmd
-
- Return da
-End Function
-</code>
-<code lang="C#">
-public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
-{
- MySqlDataAdapter da = new MySqlDataAdapter();
- MySqlCommand cmd;
- MySqlParameter parm;
+ return da;
+ }
+ </code>
+ </example>
+ </DeleteCommand>
- // Create the SelectCommand.
- cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn);
+ <InsertCommand>
+ <summary>
+ Gets or sets a SQL statement or stored procedure used to insert records into the data set.
+ </summary>
+ <value>
+ A <see cref="MySqlCommand"/> used during <see cref="System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/> to insert records into the
+ database that correspond to new rows in the <see cref="DataSet"/>.
+ </value>
+ <remarks>
+ <para>
+ During <see cref="System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/>, if this property is not set and primary key information
+ is present in the <see cref="DataSet"/>, the <B>InsertCommand</B> can be generated
+ automatically if you set the <see cref="SelectCommand"/> property and use the
+ <see cref="MySqlCommandBuilder"/>. Then, any additional commands that you do not set are
+ generated by the <B>MySqlCommandBuilder</B>. This generation logic requires key column
+ information to be present in the <B>DataSet</B>.
+ </para>
+ <para>
+ When <B>InsertCommand</B> is assigned to a previously created <see cref="MySqlCommand"/>,
+ the <B>MySqlCommand</B> is not cloned. The <B>InsertCommand</B> maintains a reference
+ to the previously created <B>MySqlCommand</B> object.
+ </para>
+ <note>
+ If execution of this command returns rows, these rows may be added to the <B>DataSet</B>
+ depending on how you set the <see cref="MySqlCommand.UpdatedRowSource"/> property of the <B>MySqlCommand</B> object.
+ </note>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlDataAdapter"/> and sets the
+ <see cref="SelectCommand"/> and <B>InsertCommand</B> properties. It assumes you have already
+ created a <see cref="MySqlConnection"/> object.
+ <code lang="vbnet">
+ Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
- cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15);
- cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15);
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter()
+ Dim cmd As MySqlCommand
+ Dim parm As MySqlParameter
- da.SelectCommand = cmd;
+ ' Create the SelectCommand.
+ cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn)
- // Create the UpdateCommand.
- cmd = new MySqlCommand("UPDATE mytable SET id=?id, name=?name WHERE id=?oldId", conn);
- cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15, "id" );
- cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15, "name" );
-
- parm = cmd.Parameters.Add( "?oldId", MySqlDbType.VarChar, 15, "id" );
- parm.SourceVersion = DataRowVersion.Original;
-
- da.UpdateCommand = cmd;
+ cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15)
+ cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15)
- return da;
-}
-</code>
- </example>
-</UpdateCommand>
+ da.SelectCommand = cmd
-<SelectCommand>
- <summary>
- Gets or sets a SQL statement or stored procedure used to select records in the data source.
- </summary>
- <value>
- A <see cref="MySqlCommand"/> used during <see cref="System.Data.Common.DbDataAdapter.Fill(DataSet)"/> to select records from the
- database for placement in the <see cref="DataSet"/>.
- </value>
- <remarks>
- <para>When <B>SelectCommand</B> is assigned to a previously created <see cref="MySqlCommand"/>,
- the <B>MySqlCommand</B> is not cloned. The <B>SelectCommand</B> maintains a reference to the
- previously created <B>MySqlCommand</B> object.
- </para>
- <para>
- If the <B>SelectCommand</B> does not return any rows, no tables are added to the
- <see cref="DataSet"/>, and no exception is raised.
- </para>
- </remarks>
- <example>
-The following example creates a <see cref="MySqlDataAdapter"/> and sets the
-<see cref="SelectCommand"/> and <B>InsertCommand</B> properties. It assumes you have already
-created a <see cref="MySqlConnection"/> object.
-<code lang="Visual Basic">
-Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
-
- Dim da As MySqlDataAdapter = New MySqlDataAdapter()
- Dim cmd As MySqlCommand
- Dim parm As MySqlParameter
+ ' Create the InsertCommand.
+ cmd = New MySqlCommand("INSERT INTO mytable (id,name) VALUES (?id, ?name)", conn)
- ' Create the SelectCommand.
- cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn)
+ cmd.Parameters.Add( "?id", MySqlDbType.VarChar, 15, "id" )
+ cmd.Parameters.Add( "?name", MySqlDbType.VarChar, 15, "name" )
+ da.InsertCommand = cmd
- cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15)
- cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15)
+ Return da
+ End Function
+ </code>
+ <code lang="C#">
+ public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
+ {
+ MySqlDataAdapter da = new MySqlDataAdapter();
+ MySqlCommand cmd;
+ MySqlParameter parm;
- da.SelectCommand = cmd
+ // Create the SelectCommand.
+ cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn);
- ' Create the InsertCommand.
- cmd = New MySqlCommand("INSERT INTO mytable (id,name) VALUES (?id, ?name)", conn)
+ cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15);
+ cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15);
- cmd.Parameters.Add( "?id", MySqlDbType.VarChar, 15, "id" )
- cmd.Parameters.Add( "?name", MySqlDbType.VarChar, 15, "name" )
- da.InsertCommand = cmd
-
- Return da
-End Function
-</code>
-<code lang="C#">
-public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
-{
- MySqlDataAdapter da = new MySqlDataAdapter();
- MySqlCommand cmd;
- MySqlParameter parm;
+ da.SelectCommand = cmd;
- // Create the SelectCommand.
- cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn);
+ // Create the InsertCommand.
+ cmd = new MySqlCommand("INSERT INTO mytable (id,name) VALUES (?id,?name)", conn);
+ cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15, "id" );
+ cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15, "name" );
- cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15);
- cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15);
+ da.InsertCommand = cmd;
- da.SelectCommand = cmd;
+ return da;
+ }
+ </code>
+ </example>
+ </InsertCommand>
- // Create the InsertCommand.
- cmd = new MySqlCommand("INSERT INTO mytable (id,name) VALUES (?id,?name)", conn);
- cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15, "id" );
- cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15, "name" );
-
- da.InsertCommand = cmd;
+ <UpdateCommand>
+ <summary>
+ Gets or sets a SQL statement or stored procedure used to updated records in the data source.
+ </summary>
+ <value>
+ A <see cref="MySqlCommand"/> used during <see cref="System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/> to update records in the
+ database with data from the <see cref="DataSet"/>.
+ </value>
+ <remarks>
+ <para>
+ During <see cref="System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/>, if this property is not set and primary key information
+ is present in the <see cref="DataSet"/>, the <B>UpdateCommand</B> can be generated
+ automatically if you set the <see cref="SelectCommand"/> property and use the
+ <see cref="MySqlCommandBuilder"/>. Then, any additional commands that you do not set are
+ generated by the <B>MySqlCommandBuilder</B>. This generation logic requires key column
+ information to be present in the <B>DataSet</B>.
+ </para>
+ <para>
+ When <B>UpdateCommand</B> is assigned to a previously created <see cref="MySqlCommand"/>,
+ the <B>MySqlCommand</B> is not cloned. The <B>UpdateCommand</B> maintains a reference
+ to the previously created <B>MySqlCommand</B> object.
+ </para>
+ <note>
+ If execution of this command returns rows, these rows may be merged with the DataSet
+ depending on how you set the <see cref="MySqlCommand.UpdatedRowSource"/> property of the <B>MySqlCommand</B> object.
+ </note>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlDataAdapter"/> and sets the
+ <see cref="SelectCommand"/> and <B>UpdateCommand</B> properties. It assumes you have already
+ created a <see cref="MySqlConnection"/> object.
+ <code lang="vbnet">
+ Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
- return da;
-}
-</code>
- </example>
-</SelectCommand>
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter()
+ Dim cmd As MySqlCommand
+ Dim parm As MySqlParameter
+ ' Create the SelectCommand.
+ cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn)
+
+ cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15)
+ cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15)
+
+ da.SelectCommand = cmd
+
+ ' Create the UpdateCommand.
+ cmd = New MySqlCommand("UPDATE mytable SET id=?id, name=?name WHERE id=?oldId", conn)
+
+ cmd.Parameters.Add( "?id", MySqlDbType.VarChar, 15, "id" )
+ cmd.Parameters.Add( "?name", MySqlDbType.VarChar, 15, "name" )
+
+ parm = cmd.Parameters.Add("?oldId", MySqlDbType.VarChar, 15, "id")
+ parm.SourceVersion = DataRowVersion.Original
+
+ da.UpdateCommand = cmd
+
+ Return da
+ End Function
+ </code>
+ <code lang="C#">
+ public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
+ {
+ MySqlDataAdapter da = new MySqlDataAdapter();
+ MySqlCommand cmd;
+ MySqlParameter parm;
+
+ // Create the SelectCommand.
+ cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn);
+
+ cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15);
+ cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15);
+
+ da.SelectCommand = cmd;
+
+ // Create the UpdateCommand.
+ cmd = new MySqlCommand("UPDATE mytable SET id=?id, name=?name WHERE id=?oldId", conn);
+ cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15, "id" );
+ cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15, "name" );
+
+ parm = cmd.Parameters.Add( "?oldId", MySqlDbType.VarChar, 15, "id" );
+ parm.SourceVersion = DataRowVersion.Original;
+
+ da.UpdateCommand = cmd;
+
+ return da;
+ }
+ </code>
+ </example>
+ </UpdateCommand>
+
+ <SelectCommand>
+ <summary>
+ Gets or sets a SQL statement or stored procedure used to select records in the data source.
+ </summary>
+ <value>
+ A <see cref="MySqlCommand"/> used during <see cref="System.Data.Common.DbDataAdapter.Fill(DataSet)"/> to select records from the
+ database for placement in the <see cref="DataSet"/>.
+ </value>
+ <remarks>
+ <para>
+ When <B>SelectCommand</B> is assigned to a previously created <see cref="MySqlCommand"/>,
+ the <B>MySqlCommand</B> is not cloned. The <B>SelectCommand</B> maintains a reference to the
+ previously created <B>MySqlCommand</B> object.
+ </para>
+ <para>
+ If the <B>SelectCommand</B> does not return any rows, no tables are added to the
+ <see cref="DataSet"/>, and no exception is raised.
+ </para>
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlDataAdapter"/> and sets the
+ <see cref="SelectCommand"/> and <B>InsertCommand</B> properties. It assumes you have already
+ created a <see cref="MySqlConnection"/> object.
+ <code lang="vbnet">
+ Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
+
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter()
+ Dim cmd As MySqlCommand
+ Dim parm As MySqlParameter
+
+ ' Create the SelectCommand.
+ cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn)
+
+ cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15)
+ cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15)
+
+ da.SelectCommand = cmd
+
+ ' Create the InsertCommand.
+ cmd = New MySqlCommand("INSERT INTO mytable (id,name) VALUES (?id, ?name)", conn)
+
+ cmd.Parameters.Add( "?id", MySqlDbType.VarChar, 15, "id" )
+ cmd.Parameters.Add( "?name", MySqlDbType.VarChar, 15, "name" )
+ da.InsertCommand = cmd
+
+ Return da
+ End Function
+ </code>
+ <code lang="C#">
+ public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
+ {
+ MySqlDataAdapter da = new MySqlDataAdapter();
+ MySqlCommand cmd;
+ MySqlParameter parm;
+
+ // Create the SelectCommand.
+ cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=?id AND name=?name", conn);
+
+ cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15);
+ cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15);
+
+ da.SelectCommand = cmd;
+
+ // Create the InsertCommand.
+ cmd = new MySqlCommand("INSERT INTO mytable (id,name) VALUES (?id,?name)", conn);
+ cmd.Parameters.Add("?id", MySqlDbType.VarChar, 15, "id" );
+ cmd.Parameters.Add("?name", MySqlDbType.VarChar, 15, "name" );
+
+ da.InsertCommand = cmd;
+
+ return da;
+ }
+ </code>
+ </example>
+ </SelectCommand>
+
</docs>
\ No newline at end of file
Modified: branches/5.1/Driver/Source/docs/MySqlDataReader.xml
===================================================================
--- branches/5.1/Driver/Source/docs/MySqlDataReader.xml 2007-11-01 20:58:53 UTC (rev 1054)
+++ branches/5.1/Driver/Source/docs/MySqlDataReader.xml 2007-11-02 21:13:58 UTC (rev 1055)
@@ -35,7 +35,7 @@
a <see cref="MySqlCommand"/>, and a <B>MySqlDataReader</B>. The example reads through
the data, writing it out to the console. Finally, the example closes the <B>MySqlDataReader</B>, then the
<B>MySqlConnection</B>.
- <code lang="Visual Basic">
+ <code lang="vbnet">
Public Sub ReadMyData(myConnString As String)
Dim mySelectQuery As String = "SELECT OrderID, CustomerID FROM Orders"
Dim myConnection As New MySqlConnection(myConnString)
Modified: branches/5.1/Driver/Source/docs/MySqlException.xml
===================================================================
--- branches/5.1/Driver/Source/docs/MySqlException.xml 2007-11-01 20:58:53 UTC (rev 1054)
+++ branches/5.1/Driver/Source/docs/MySqlException.xml 2007-11-02 21:13:58 UTC (rev 1055)
@@ -1,53 +1,53 @@
<MyDocs>
-<MyMembers name="Class">
-<remarks>
- <para>
- This class is created whenever the MySql Data Provider encounters an error generated from the server.
- </para>
- <para>
- Any open connections are not automatically closed when an exception is thrown. If
- the client application determines that the exception is fatal, it should close any open
- <see cref="MySqlDataReader"/> objects or <see cref="MySqlConnection"/> objects.
- </para>
-</remarks>
+ <MyMembers name="Class">
+ <remarks>
+ <para>
+ This class is created whenever the MySql Data Provider encounters an error generated from the server.
+ </para>
+ <para>
+ Any open connections are not automatically closed when an exception is thrown. If
+ the client application determines that the exception is fatal, it should close any open
+ <see cref="MySqlDataReader"/> objects or <see cref="MySqlConnection"/> objects.
+ </para>
+ </remarks>
-<example>
- The following example generates a <B>MySqlException</B> due to a missing server,
- and then displays the exception.
-
- <code lang="Visual Basic">
-Public Sub ShowException()
- Dim mySelectQuery As String = "SELECT column1 FROM table1"
- Dim myConnection As New MySqlConnection ("Data Source=localhost;Database=Sample;")
- Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
+ <example>
+ The following example generates a <B>MySqlException</B> due to a missing server,
+ and then displays the exception.
- Try
- myCommand.Connection.Open()
- Catch e As MySqlException
- MessageBox.Show( e.Message )
- End Try
- End Sub
- </code>
- <code lang="C#">
-public void ShowException()
-{
- string mySelectQuery = "SELECT column1 FROM table1";
- MySqlConnection myConnection =
- new MySqlConnection("Data Source=localhost;Database=Sample;");
- MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection);
+ <code lang="vbnet">
+ Public Sub ShowException()
+ Dim mySelectQuery As String = "SELECT column1 FROM table1"
+ Dim myConnection As New MySqlConnection ("Data Source=localhost;Database=Sample;")
+ Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
- try
- {
- myCommand.Connection.Open();
- }
- catch (MySqlException e)
- {
- MessageBox.Show( e.Message );
- }
-}
- </code>
-</example>
+ Try
+ myCommand.Connection.Open()
+ Catch e As MySqlException
+ MessageBox.Show( e.Message )
+ End Try
+ End Sub
+ </code>
+ <code lang="C#">
+ public void ShowException()
+ {
+ string mySelectQuery = "SELECT column1 FROM table1";
+ MySqlConnection myConnection =
+ new MySqlConnection("Data Source=localhost;Database=Sample;");
+ MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection);
+ try
+ {
+ myCommand.Connection.Open();
+ }
+ catch (MySqlException e)
+ {
+ MessageBox.Show( e.Message );
+ }
+ }
+ </code>
+ </example>
-</MyMembers>
+
+ </MyMembers>
</MyDocs>
\ No newline at end of file
Modified: branches/5.1/Driver/Source/docs/MySqlHelper.xml
===================================================================
--- branches/5.1/Driver/Source/docs/MySqlHelper.xml 2007-11-01 20:58:53 UTC (rev 1054)
+++ branches/5.1/Driver/Source/docs/MySqlHelper.xml 2007-11-02 21:13:58 UTC (rev 1055)
@@ -1,53 +1,53 @@
<MyDocs>
-<MyMembers name="Class">
-<remarks>
- <para>
- This class is created whenever the MySql Data Provider encounters an error generated from the server.
- </para>
- <para>
- Any open connections are not automatically closed when an exception is thrown. If
- the client application determines that the exception is fatal, it should close any open
- <see cref="MySqlDataReader"/> objects or <see cref="MySqlConnection"/> objects.
- </para>
-</remarks>
+ <MyMembers name="Class">
+ <remarks>
+ <para>
+ This class is created whenever the MySql Data Provider encounters an error generated from the server.
+ </para>
+ <para>
+ Any open connections are not automatically closed when an exception is thrown. If
+ the client application determines that the exception is fatal, it should close any open
+ <see cref="MySqlDataReader"/> objects or <see cref="MySqlConnection"/> objects.
+ </para>
+ </remarks>
-<example>
- The following example generates a <B>MySqlException</B> due to a missing server,
- and then displays the exception.
-
- <code lang="Visual Basic">
-Public Sub ShowException()
- Dim mySelectQuery As String = "SELECT column1 FROM table1"
- Dim myConnection As New MySqlConnection ("Data Source=localhost;Database=Sample;")
- Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
+ <example>
+ The following example generates a <B>MySqlException</B> due to a missing server,
+ and then displays the exception.
- Try
- myCommand.Connection.Open()
- Catch e As MySqlException
- MessageBox.Show( e.Message )
- End Try
- End Sub
- </code>
- <code lang="C#">
-public void ShowException()
-{
- string mySelectQuery = "SELECT column1 FROM table1";
- MySqlConnection myConnection =
- new MySqlConnection("Data Source=localhost;Database=Sample;");
- MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection);
+ <code lang="vbnet">
+ Public Sub ShowException()
+ Dim mySelectQuery As String = "SELECT column1 FROM table1"
+ Dim myConnection As New MySqlConnection ("Data Source=localhost;Database=Sample;")
+ Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
- try
- {
- myCommand.Connection.Open();
- }
- catch (MySqlException e)
- {
- MessageBox.Show( e.Message );
- }
-}
- </code>
-</example>
+ Try
+ myCommand.Connection.Open()
+ Catch e As MySqlException
+ MessageBox.Show( e.Message )
+ End Try
+ End Sub
+ </code>
+ <code lang="C#">
+ public void ShowException()
+ {
+ string mySelectQuery = "SELECT column1 FROM table1";
+ MySqlConnection myConnection =
+ new MySqlConnection("Data Source=localhost;Database=Sample;");
+ MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection);
+ try
+ {
+ myCommand.Connection.Open();
+ }
+ catch (MySqlException e)
+ {
+ MessageBox.Show( e.Message );
+ }
+ }
+ </code>
+ </example>
-</MyMembers>
+
+ </MyMembers>
</MyDocs>
\ No newline at end of file
Modified: branches/5.1/Driver/Source/docs/MySqlParameter.xml
===================================================================
--- branches/5.1/Driver/Source/docs/MySqlParameter.xml 2007-11-01 20:58:53 UTC (rev 1054)
+++ branches/5.1/Driver/Source/docs/MySqlParameter.xml 2007-11-02 21:13:58 UTC (rev 1055)
@@ -1,45 +1,45 @@
<MyDocs>
-<MyMembers name="Class">
-<remarks>
- Parameter names are not case sensitive.
-</remarks>
+ <MyMembers name="Class">
+ <remarks>
+ Parameter names are not case sensitive.
+ </remarks>
-<example>
- The following example creates multiple instances of <B>MySqlParameter</B> through the
- <see cref="MySqlParameterCollection"/> collection within the <see cref="MySqlDataAdapter"/>.
- These parameters are used to select data from the data source and place the data
- in the <see cref="DataSet"/>. This example assumes that a <B>DataSet</B> and a
- <B>MySqlDataAdapter</B> have already been created with the appropriate schema, commands,
- and connection.
-<code lang="Visual Basic">
-Public Sub AddSqlParameters()
- ' ...
- ' create myDataSet and myDataAdapter
- ' ...
- myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters"
- myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239
-
- myDataAdapter.Fill(myDataSet)
-End Sub 'AddSqlParameters
- </code>
- <code lang="C#">
-public void AddSqlParameters()
-{
-// ...
-// create myDataSet and myDataAdapter
-// ...
+ <example>
+ The following example creates multiple instances of <B>MySqlParameter</B> through the
+ <see cref="MySqlParameterCollection"/> collection within the <see cref="MySqlDataAdapter"/>.
+ These parameters are used to select data from the data source and place the data
+ in the <see cref="DataSet"/>. This example assumes that a <B>DataSet</B> and a
+ <B>MySqlDataAdapter</B> have already been created with the appropriate schema, commands,
+ and connection.
+ <code lang="vbnet">
+ Public Sub AddSqlParameters()
+ ' ...
+ ' create myDataSet and myDataAdapter
+ ' ...
+ myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters"
+ myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239
- myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters";
- myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239;
- myDataAdapter.Fill(myDataSet);
+ myDataAdapter.Fill(myDataSet)
+ End Sub 'AddSqlParameters
+ </code>
+ <code lang="C#">
+ public void AddSqlParameters()
+ {
+ // ...
+ // create myDataSet and myDataAdapter
+ // ...
-}
- </code>
-</example>
+ myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters";
+ myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239;
+ myDataAdapter.Fill(myDataSet);
+ }
+ </code>
+ </example>
-</MyMembers>
+ </MyMembers>
+
</MyDocs>
\ No newline at end of file
Modified: branches/5.1/Driver/Source/docs/MySqlParameterCollection.xml
===================================================================
--- branches/5.1/Driver/Source/docs/MySqlParameterCollection.xml 2007-11-01 20:58:53 UTC (rev 1054)
+++ branches/5.1/Driver/Source/docs/MySqlParameterCollection.xml 2007-11-02 21:13:58 UTC (rev 1055)
@@ -1,45 +1,45 @@
<MyDocs>
-<MyMembers name="Class">
-<remarks>
- The number of the parameters in the collection must be equal to the number of
-parameter placeholders within the command text, or an exception will be generated.
-</remarks>
+ <MyMembers name="Class">
+ <remarks>
+ The number of the parameters in the collection must be equal to the number of
+ parameter placeholders within the command text, or an exception will be generated.
+ </remarks>
-<example>
- The following example creates multiple instances of <see cref="MySqlParameter"/>
- through the <B>MySqlParameterCollection</B> collection within the <see cref="MySqlDataAdapter"/>.
- These parameters are used to select data within the data source and place the data in
- the <see cref="System.Data.DataSet"/>. This code assumes that a <B>DataSet</B> and a <B>MySqlDataAdapter</B>
- have already been created with the appropriate schema, commands, and connection.
-<code lang="Visual Basic">
-Public Sub AddParameters()
- ' ...
- ' create myDataSet and myDataAdapter
- ' ...
- myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters"
- myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239
-
- myDataAdapter.Fill(myDataSet)
-End Sub 'AddSqlParameters
- </code>
- <code lang="C#">
-public void AddSqlParameters()
-{
-// ...
-// create myDataSet and myDataAdapter
-// ...
+ <example>
+ The following example creates multiple instances of <see cref="MySqlParameter"/>
+ through the <B>MySqlParameterCollection</B> collection within the <see cref="MySqlDataAdapter"/>.
+ These parameters are used to select data within the data source and place the data in
+ the <see cref="System.Data.DataSet"/>. This code assumes that a <B>DataSet</B> and a <B>MySqlDataAdapter</B>
+ have already been created with the appropriate schema, commands, and connection.
+ <code lang="vbnet">
+ Public Sub AddParameters()
+ ' ...
+ ' create myDataSet and myDataAdapter
+ ' ...
+ myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters"
+ myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239
- myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters";
- myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239;
- myDataAdapter.Fill(myDataSet);
+ myDataAdapter.Fill(myDataSet)
+ End Sub 'AddSqlParameters
+ </code>
+ <code lang="C#">
+ public void AddSqlParameters()
+ {
+ // ...
+ // create myDataSet and myDataAdapter
+ // ...
-}
- </code>
-</example>
+ myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters";
+ myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239;
+ myDataAdapter.Fill(myDataSet);
+ }
+ </code>
+ </example>
-</MyMembers>
+ </MyMembers>
+
</MyDocs>
\ No newline at end of file
Modified: branches/5.1/Driver/Source/docs/MySqlTransaction.xml
===================================================================
--- branches/5.1/Driver/Source/docs/MySqlTransaction.xml 2007-11-01 20:58:53 UTC (rev 1054)
+++ branches/5.1/Driver/Source/docs/MySqlTransaction.xml 2007-11-02 21:13:58 UTC (rev 1055)
@@ -1,329 +1,329 @@
<docs>
-<Class>
- <summary>
- Represents a SQL transaction to be made in a MySQL database. This class cannot be inherited.
- </summary>
+ <Class>
+ <summary>
+ Represents a SQL transaction to be made in a MySQL database. This class cannot be inherited.
+ </summary>
-<remarks>
- The application creates a <B>MySqlTransaction</B> object by calling <see cref="MySqlConnection.BeginTransaction()"/>
- on the <see cref="MySqlConnection"/> object. All subsequent operations associated with the
- transaction (for example, committing or aborting the transaction), are performed on the
- <B>MySqlTransaction</B> object.
-</remarks>
+ <remarks>
+ The application creates a <B>MySqlTransaction</B> object by calling <see cref="MySqlConnection.BeginTransaction()"/>
+ on the <see cref="MySqlConnection"/> object. All subsequent operations associated with the
+ transaction (for example, committing or aborting the transaction), are performed on the
+ <B>MySqlTransaction</B> object.
+ </remarks>
-<example>
- The following example creates a <see cref="MySqlConnection"/> and a <B>MySqlTransaction</B>.
- It also demonstrates how to use the <see cref="MySqlConnection.BeginTransaction()"/>,
- <see cref="MySqlTransaction.Commit"/>, and <see cref="MySqlTransaction.Rollback"/> methods.
- <code lang="Visual Basic">
-Public Sub RunTransaction(myConnString As String)
- Dim myConnection As New MySqlConnection(myConnString)
- myConnection.Open()
-
- Dim myCommand As MySqlCommand = myConnection.CreateCommand()
- Dim myTrans As MySqlTransaction
-
- ' Start a local transaction
- myTrans = myConnection.BeginTransaction()
- ' Must assign both transaction object and connection
- ' to Command object for a pending local transaction
- myCommand.Connection = myConnection
- myCommand.Transaction = myTrans
-
- Try
- myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')"
- myCommand.ExecuteNonQuery()
- myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')"
- myCommand.ExecuteNonQuery()
- myTrans.Commit()
- Console.WriteLine("Both records are written to database.")
- Catch e As Exception
- Try
+ <example>
+ The following example creates a <see cref="MySqlConnection"/> and a <B>MySqlTransaction</B>.
+ It also demonstrates how to use the <see cref="MySqlConnection.BeginTransaction()"/>,
+ <see cref="MySqlTransaction.Commit"/>, and <see cref="MySqlTransaction.Rollback"/> methods.
+ <code lang="vbnet">
+ Public Sub RunTransaction(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+
+ Dim myCommand As MySqlCommand = myConnection.CreateCommand()
+ Dim myTrans As MySqlTransaction
+
+ ' Start a local transaction
+ myTrans = myConnection.BeginTransaction()
+ ' Must assign both transaction object and connection
+ ' to Command object for a pending local transaction
+ myCommand.Connection = myConnection
+ myCommand.Transaction = myTrans
+
+ Try
+ myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myTrans.Commit()
+ Console.WriteLine("Both records are written to database.")
+ Catch e As Exception
+ Try
myTrans.Rollback()
- Catch ex As MySqlException
+ Catch ex As MySqlException
If Not myTrans.Connection Is Nothing Then
- Console.WriteLine("An exception of type " & ex.GetType().ToString() & _
- " was encountered while attempting to roll back the transaction.")
+ Console.WriteLine("An exception of type " & ex.GetType().ToString() & _
+ " was encountered while attempting to roll back the transaction.")
End If
- End Try
-
- Console.WriteLine("An exception of type " & e.GetType().ToString() & _
- "was encountered while inserting the data.")
- Console.WriteLine("Neither record was written to database.")
- Finally
- myConnection.Close()
- End Try
-End Sub 'RunTransaction
- </code>
- <code lang="C#">
-public void RunTransaction(string myConnString)
- {
- MySqlConnection myConnection = new MySqlConnection(myConnString);
- myConnection.Open();
+ End Try
- MySqlCommand myCommand = myConnection.CreateCommand();
- MySqlTransaction myTrans;
+ Console.WriteLine("An exception of type " & e.GetType().ToString() & _
+ "was encountered while inserting the data.")
+ Console.WriteLine("Neither record was written to database.")
+ Finally
+ myConnection.Close()
+ End Try
+ End Sub 'RunTransaction
+ </code>
+ <code lang="C#">
+ public void RunTransaction(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
- // Start a local transaction
- myTrans = myConnection.BeginTransaction();
- // Must assign both transaction object and connection
- // to Command object for a pending local transaction
- myCommand.Connection = myConnection;
- myCommand.Transaction = myTrans;
+ MySqlCommand myCommand = myConnection.CreateCommand();
+ MySqlTransaction myTrans;
- try
- {
- myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')";
- myCommand.ExecuteNonQuery();
- myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')";
- myCommand.ExecuteNonQuery();
- myTrans.Commit();
- Console.WriteLine("Both records are written to database.");
- }
- catch(Exception e)
- {
- try
- {
+ // Start a local transaction
+ myTrans = myConnection.BeginTransaction();
+ // Must assign both transaction object and connection
+ // to Command object for a pending local transaction
+ myCommand.Connection = myConnection;
+ myCommand.Transaction = myTrans;
+
+ try
+ {
+ myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myTrans.Commit();
+ Console.WriteLine("Both records are written to database.");
+ }
+ catch(Exception e)
+ {
+ try
+ {
myTrans.Rollback();
- }
- catch (MySqlException ex)
- {
+ }
+ catch (MySqlException ex)
+ {
if (myTrans.Connection != null)
{
- Console.WriteLine("An exception of type " + ex.GetType() +
- " was encountered while attempting to roll back the transaction.");
+ Console.WriteLine("An exception of type " + ex.GetType() +
+ " was encountered while attempting to roll back the transaction.");
}
- }
-
- Console.WriteLine("An exception of type " + e.GetType() +
- " was encountered while inserting the data.");
- Console.WriteLine("Neither record was written to database.");
- }
- finally
- {
- myConnection.Close();
- }
-}
- </code>
-</example>
+ }
+ Console.WriteLine("An exception of type " + e.GetType() +
+ " was encountered while inserting the data.");
+ Console.WriteLine("Neither record was written to database.");
+ }
+ finally
+ {
+ myConnection.Close();
+ }
+ }
+ </code>
+ </example>
-</Class>
-<Rollback>
- <summary>
- Rolls back a transaction from a pending state.
- </summary>
- <remarks>
- The Rollback method is equivalent to the MySQL statement ROLLBACK.
- The transaction can only be rolled back from a pending state
- (after BeginTransaction has been called, but before Commit is
- called).
- </remarks>
- <example>
-The following example creates a <see cref="MySqlConnection"/> and a
-<see cref="MySqlTransaction"/>. It also demonstrates how to use the
-<see cref="MySqlConnection.BeginTransaction()"/>, <see cref="Commit"/>, and <B>Rollback</B>
-methods.
-<code lang="Visual Basic">
-Public Sub RunSqlTransaction(myConnString As String)
- Dim myConnection As New MySqlConnection(myConnString)
- myConnection.Open()
-
- Dim myCommand As MySqlCommand = myConnection.CreateCommand()
- Dim myTrans As MySqlTransaction
-
- ' Start a local transaction
- myTrans = myConnection.BeginTransaction()
-
- ' Must assign both transaction object and connection
- ' to Command object for a pending local transaction
- myCommand.Connection = myConnection
- myCommand.Transaction = myTrans
-
- Try
- myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')"
- myCommand.ExecuteNonQuery()
- myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')"
- myCommand.ExecuteNonQuery()
- myTrans.Commit()
- Console.WriteLine("Success.")
- Catch e As Exception
- Try
+ </Class>
+
+ <Rollback>
+ <summary>
+ Rolls back a transaction from a pending state.
+ </summary>
+ <remarks>
+ The Rollback method is equivalent to the MySQL statement ROLLBACK.
+ The transaction can only be rolled back from a pending state
+ (after BeginTransaction has been called, but before Commit is
+ called).
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlConnection"/> and a
+ <see cref="MySqlTransaction"/>. It also demonstrates how to use the
+ <see cref="MySqlConnection.BeginTransaction()"/>, <see cref="Commit"/>, and <B>Rollback</B>
+ methods.
+ <code lang="vbnet">
+ Public Sub RunSqlTransaction(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+
+ Dim myCommand As MySqlCommand = myConnection.CreateCommand()
+ Dim myTrans As MySqlTransaction
+
+ ' Start a local transaction
+ myTrans = myConnection.BeginTransaction()
+
+ ' Must assign both transaction object and connection
+ ' to Command object for a pending local transaction
+ myCommand.Connection = myConnection
+ myCommand.Transaction = myTrans
+
+ Try
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myTrans.Commit()
+ Console.WriteLine("Success.")
+ Catch e As Exception
+ Try
myTrans.Rollback()
- Catch ex As MySqlException
+ Catch ex As MySqlException
If Not myTrans.Connection Is Nothing Then
- Console.WriteLine("An exception of type " & ex.GetType().ToString() & _
- " was encountered while attempting to roll back the transaction.")
+ Console.WriteLine("An exception of type " & ex.GetType().ToString() & _
+ " was encountered while attempting to roll back the transaction.")
End If
- End Try
-
- Console.WriteLine("An exception of type " & e.GetType().ToString() & _
- "was encountered while inserting the data.")
- Console.WriteLine("Neither record was written to database.")
- Finally
- myConnection.Close()
- End Try
-End Sub
-</code>
-<code lang="C#">
-public void RunSqlTransaction(string myConnString)
- {
- MySqlConnection myConnection = new MySqlConnection(myConnString);
- myConnection.Open();
+ End Try
- MySqlCommand myCommand = myConnection.CreateCommand();
- MySqlTransaction myTrans;
+ Console.WriteLine("An exception of type " & e.GetType().ToString() & _
+ "was encountered while inserting the data.")
+ Console.WriteLine("Neither record was written to database.")
+ Finally
+ myConnection.Close()
+ End Try
+ End Sub
+ </code>
+ <code lang="C#">
+ public void RunSqlTransaction(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
- // Start a local transaction
- myTrans = myConnection.BeginTransaction();
- // Must assign both transaction object and connection
- // to Command object for a pending local transaction
- myCommand.Connection = myConnection;
- myCommand.Transaction = myTrans;
+ MySqlCommand myCommand = myConnection.CreateCommand();
+ MySqlTransaction myTrans;
- try
- {
- myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')";
- myCommand.ExecuteNonQuery();
- myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')";
- myCommand.ExecuteNonQuery();
- myTrans.Commit();
- Console.WriteLine("Both records are written to database.");
- }
- catch(Exception e)
- {
- try
- {
+ // Start a local transaction
+ myTrans = myConnection.BeginTransaction();
+ // Must assign both transaction object and connection
+ // to Command object for a pending local transaction
+ myCommand.Connection = myConnection;
+ myCommand.Transaction = myTrans;
+
+ try
+ {
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myTrans.Commit();
+ Console.WriteLine("Both records are written to database.");
+ }
+ catch(Exception e)
+ {
+ try
+ {
myTrans.Rollback();
- }
- catch (MySqlException ex)
- {
+ }
+ catch (MySqlException ex)
+ {
if (myTrans.Connection != null)
{
- Console.WriteLine("An exception of type " + ex.GetType() +
- " was encountered while attempting to roll back the transaction.");
+ Console.WriteLine("An exception of type " + ex.GetType() +
+ " was encountered while attempting to roll back the transaction.");
}
- }
-
- Console.WriteLine("An exception of type " + e.GetType() +
- " was encountered while inserting the data.");
- Console.WriteLine("Neither record was written to database.");
- }
- finally
- {
- myConnection.Close();
- }
-}
-</code>
- </example>
-</Rollback>
+ }
-<Commit>
- <summary>
- Commits the database transaction.
- </summary>
- <remarks>
- The <b>Commit</b> method is equivalent to the MySQL SQL statement
- COMMIT.
- </remarks>
- <example>
-The following example creates a <see cref="MySqlConnection"/> and a
-<see cref="MySqlTransaction"/>. It also demonstrates how to use the
-<see cref="MySqlConnection.BeginTransaction()"/>, <see cref="Commit"/>, and <B>Rollback</B>
-methods.
-<code lang="Visual Basic">
-Public Sub RunSqlTransaction(myConnString As String)
- Dim myConnection As New MySqlConnection(myConnString)
- myConnection.Open()
-
- Dim myCommand As MySqlCommand = myConnection.CreateCommand()
- Dim myTrans As MySqlTransaction
-
- ' Start a local transaction
- myTrans = myConnection.BeginTransaction()
-
- ' Must assign both transaction object and connection
- ' to Command object for a pending local transaction
- myCommand.Connection = myConnection
- myCommand.Transaction = myTrans
-
- Try
- myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')"
- myCommand.ExecuteNonQuery()
- myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')"
- myCommand.ExecuteNonQuery()
- myTrans.Commit()
- Console.WriteLine("Success.")
- Catch e As Exception
- Try
+ Console.WriteLine("An exception of type " + e.GetType() +
+ " was encountered while inserting the data.");
+ Console.WriteLine("Neither record was written to database.");
+ }
+ finally
+ {
+ myConnection.Close();
+ }
+ }
+ </code>
+ </example>
+ </Rollback>
+
+ <Commit>
+ <summary>
+ Commits the database transaction.
+ </summary>
+ <remarks>
+ The <b>Commit</b> method is equivalent to the MySQL SQL statement
+ COMMIT.
+ </remarks>
+ <example>
+ The following example creates a <see cref="MySqlConnection"/> and a
+ <see cref="MySqlTransaction"/>. It also demonstrates how to use the
+ <see cref="MySqlConnection.BeginTransaction()"/>, <see cref="Commit"/>, and <B>Rollback</B>
+ methods.
+ <code lang="vbnet">
+ Public Sub RunSqlTransaction(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+
+ Dim myCommand As MySqlCommand = myConnection.CreateCommand()
+ Dim myTrans As MySqlTransaction
+
+ ' Start a local transaction
+ myTrans = myConnection.BeginTransaction()
+
+ ' Must assign both transaction object and connection
+ ' to Command object for a pending local transaction
+ myCommand.Connection = myConnection
+ myCommand.Transaction = myTrans
+
+ Try
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myTrans.Commit()
+ Console.WriteLine("Success.")
+ Catch e As Exception
+ Try
myTrans.Rollback()
- Catch ex As MySqlException
+ Catch ex As MySqlException
If Not myTrans.Connection Is Nothing Then
- Console.WriteLine("An exception of type " & ex.GetType().ToString() & _
- " was encountered while attempting to roll back the transaction.")
+ Console.WriteLine("An exception of type " & ex.GetType().ToString() & _
+ " was encountered while attempting to roll back the transaction.")
End If
- End Try
-
- Console.WriteLine("An exception of type " & e.GetType().ToString() & _
- "was encountered while inserting the data.")
- Console.WriteLine("Neither record was written to database.")
- Finally
- myConnection.Close()
- End Try
-End Sub
-</code>
-<code lang="C#">
-public void RunSqlTransaction(string myConnString)
- {
- MySqlConnection myConnection = new MySqlConnection(myConnString);
- myConnection.Open();
+ End Try
- MySqlCommand myCommand = myConnection.CreateCommand();
- MySqlTransaction myTrans;
+ Console.WriteLine("An exception of type " & e.GetType().ToString() & _
+ "was encountered while inserting the data.")
+ Console.WriteLine("Neither record was written to database.")
+ Finally
+ myConnection.Close()
+ End Try
+ End Sub
+ </code>
+ <code lang="C#">
+ public void RunSqlTransaction(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
- // Start a local transaction
- myTrans = myConnection.BeginTransaction();
- // Must assign both transaction object and connection
- // to Command object for a pending local transaction
- myCommand.Connection = myConnection;
- myCommand.Transaction = myTrans;
+ MySqlCommand myCommand = myConnection.CreateCommand();
+ MySqlTransaction myTrans;
- try
- {
- myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')";
- myCommand.ExecuteNonQuery();
- myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')";
- myCommand.ExecuteNonQuery();
- myTrans.Commit();
- Console.WriteLine("Both records are written to database.");
- }
- catch(Exception e)
- {
- try
- {
+ // Start a local transaction
+ myTrans = myConnection.BeginTransaction();
+ // Must assign both transaction object and connection
+ // to Command object for a pending local transaction
+ myCommand.Connection = myConnection;
+ myCommand.Transaction = myTrans;
+
+ try
+ {
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myTrans.Commit();
+ Console.WriteLine("Both records are written to database.");
+ }
+ catch(Exception e)
+ {
+ try
+ {
myTrans.Rollback();
- }
- catch (MySqlException ex)
- {
+ }
+ catch (MySqlException ex)
+ {
if (myTrans.Connection != null)
{
- Console.WriteLine("An exce