#At file:///C:/bzr-connector-net/6.2/ based on revid:vvaintroub@stripped0t9o1jnnr
813 Reggie Burnett 2009-12-15
update documentation from source
removed:
Documentation/Users Guide/connector-net-programming-tutorial.aml
added:
Documentation/Users Guide/connector-net-tutorials.aml
Documentation/Users Guide/media/connector-net-tutorials-1.png
Documentation/Users Guide/media/connector-net-tutorials-asp-provider-profile-simple-app.png
Documentation/Users Guide/media/connector-net-tutorials-authentication-type.png
Documentation/Users Guide/media/connector-net-tutorials-create-user.png
Documentation/Users Guide/media/connector-net-tutorials-security-tab.png
Documentation/Users Guide/media/connector-net-tutorials-select-provider.png
Documentation/Users Guide/media/connector-net-tutorials-tables.png
Documentation/Users Guide/media/connector-net-tutorials-users-roles-tables.png
modified:
Documentation/Users Guide/connector-net-core.aml
Documentation/Users Guide/connector-net-programming-connection-options.aml
Documentation/Users Guide/connector-net-programming.aml
Documentation/Users Guide/connector-net-versions.aml
Documentation/Users Guide/connector-net-visual-studio.aml
Documentation/config.txt
Documentation/help.shfbproj
Documentation/images.proj
=== modified file 'Documentation/Users Guide/connector-net-core.aml'
=== modified file 'Documentation/Users Guide/connector-net-core.aml'
--- a/Documentation/Users Guide/connector-net-core.aml 2009-09-08 17:05:09 +0000
+++ b/Documentation/Users Guide/connector-net-core.aml 2009-12-15 21:58:48 +0000
@@ -18,23 +18,8 @@
<list class="bullet">
<listItem>
<para>
- MySQL 6.0 features
- </para>
- </listItem>
- <listItem>
- <para>
- MySQL 5.1 features
- </para>
- </listItem>
- <listItem>
- <para>
- MySQL 5.0 features (such as stored procedures)
- </para>
- </listItem>
- <listItem>
- <para>
- MySQL 4.1 features (server-side prepared statements, Unicode,
- and shared memory access, and so forth)
+ Features provided by MySQL Server up to and including MySQL
+ Server version 5.4.
</para>
</listItem>
<listItem>
=== modified file 'Documentation/Users Guide/connector-net-programming-connection-options.aml'
--- a/Documentation/Users Guide/connector-net-programming-connection-options.aml 2009-09-08 17:12:22 +0000
+++ b/Documentation/Users Guide/connector-net-programming-connection-options.aml 2009-12-15 21:58:48 +0000
@@ -109,6 +109,73 @@
<row>
<entry>
<para>
+ <literal>CertificateFile</literal>
+ </para>
+ </entry>
+ <entry>
+ <para>null</para>
+ </entry>
+ <entry>
+ <para>This option specifies the path to a certificate file in PFX format. For
+ an example of usage see
+ <link xlink:href="34e3033f-b986-4073-95c8-945f73aa79b0#connector-net-tutorials-ssl">Tutorial: Using SSL with </link>. Was
+ introduced with 6.2.1.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
+ <literal>CertificatePassword</literal>
+ </para>
+ </entry>
+ <entry>
+ <para>null</para>
+ </entry>
+ <entry>
+ <para>This option allows you to specify a password which is used in
+ conjunction with a certificate specified using the option
+ <literal>CertificateFile</literal>. For an example of usage
+ see <link xlink:href="34e3033f-b986-4073-95c8-945f73aa79b0#connector-net-tutorials-ssl">Tutorial: Using SSL with </link>. Was
+ introduced with 6.2.1.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
+ <literal>Certificate Store Location</literal>
+ </para>
+ </entry>
+ <entry>
+ <para>null</para>
+ </entry>
+ <entry>
+ <para>This option allows you to access a certificate held in a personal store,
+ rather than use a certificate file and password combination.
+ For an example of usage see
+ <link xlink:href="34e3033f-b986-4073-95c8-945f73aa79b0#connector-net-tutorials-ssl">Tutorial: Using SSL with </link>. Was
+ introduced with 6.2.1.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
+ <literal>Certificate Thumbprint</literal>
+ </para>
+ </entry>
+ <entry>
+ <para>null</para>
+ </entry>
+ <entry>
+ <para>This option allows you to specify a certificate thumbprint to ensure
+ correct identifcation of a certificate contained within a
+ personal store. For an example of usage see
+ <link xlink:href="34e3033f-b986-4073-95c8-945f73aa79b0#connector-net-tutorials-ssl">Tutorial: Using SSL with </link>. Was
+ introduced with 6.2.1.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
<literal>CharSet</literal>, <literal>Character Set</literal></para>
</entry>
<entry>
@@ -172,8 +239,7 @@
</para>
</entry>
<entry>
- <para>
- </para>
+ <para>30</para>
</entry>
<entry>
<para>Sets the default value of the command timeout to be used. This does not
@@ -198,7 +264,11 @@
values are <literal>true</literal>,
<literal>false</literal>, <literal>yes</literal>, and
<literal>no</literal>. In versions before 5.0.3, this option
- had no effect.</para>
+ had no effect. From version 6.2.1 this option is deprecated
+ and is replaced by <literal>SSL Mode</literal>. However, the
+ option is still supported if used. If this option is set to
+ true it is equivalent to <literal>SSL Mode =
+ Preferred</literal>.</para>
</entry>
</row>
<row>
@@ -465,6 +535,34 @@
<row>
<entry>
<para>
+ <literal>SSL Mode</literal>
+ </para>
+ </entry>
+ <entry>
+ <para>None</para>
+ </entry>
+ <entry>
+ <para>This option has the following values:
+
+ <list class="bullet"><listItem><para><legacyBold>None</legacyBold> - do not use
+ SSL.
+ </para></listItem><listItem><para><legacyBold>Preferred</legacyBold> - use SSL
+ if the server supports it, but allow connection in all
+ cases.
+ </para></listItem><listItem><para><legacyBold>Required</legacyBold> - Always use
+ SSL. Deny connection if server does not support SSL.
+ </para></listItem><listItem><para><legacyBold>VerifyCA</legacyBold> - Always use
+ SSL. Validate the CA but tolerate name mismatch.
+ </para></listItem><listItem><para><legacyBold>VerifyFull</legacyBold> - Always
+ use SSL. Fail if the host name is not correct.
+ </para></listItem></list><para>
+ This option was introduced in 6.1.1.
+ </para></para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>
<literal>TreatBlobsAsUTF8</literal>
</para>
</entry>
@@ -644,7 +742,7 @@
</entry>
<entry>
<para>Specifies whether server variables should be updated when a pooled
- connection is returned. Turning this one will yeild faster
+ connection is returned. Turning this on will yield faster
opens but will also not catch any server changes made by
other connections.</para>
</entry>
=== removed file 'Documentation/Users Guide/connector-net-programming-tutorial.aml'
--- a/Documentation/Users Guide/connector-net-programming-tutorial.aml 2009-09-08 17:05:09 +0000
+++ b/Documentation/Users Guide/connector-net-programming-tutorial.aml 1970-01-01 00:00:00 +0000
@@ -1,760 +0,0 @@
-<topic id="34e3033f-b986-4073-95c8-945f73aa79b0" revisionNumber="1">
- <developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
- <section address="connector-net-programming-tutorial">
- <title>Tutorial: An Introduction to Connector/NET Programming</title>
- <content>
- <autoOutline />
- <para>
- This section provides a gentle introduction to programming with
- Connector/NET. The example code is written in C#, and is designed to
- work on both Microsoft .NET Framework and Mono.
- </para>
- <para>
- This tutorial is designed to get you up and running with
- Connector/NET as quickly as possible, it does not go into detail on
- any particular topic. However, the following sections of this manual
- describe each of the topics introduced in this tutorial in more
- detail. In this tutorial you are encouraged to type in and run the
- code, modifying it as required for your setup.
- </para>
- <para>
- This tutorial assumes you have MySQL and Connector/NET already
- installed. It also assumes that you have installed the World example
- database, which can be downloaded from the
- <externalLink><linkText>MySQL Documentation
- page</linkText><linkUri>http://dev.mysql.com/doc/</linkUri></externalLink>. You can also find details on how to install the
- database on the same page.
- </para>
- <alert class="note">
- <para>
- Before compiling the example code make sure that you have added
- References to your project as required. The References required
- are <literal>System</literal>, <literal>System.Data</literal> and
- <literal>MySql.Data</literal>.
- </para>
- </alert>
- </content>
- </section>
- <section address="connector-net-programming-tutorial-connection">
- <title>The MySqlConnection Object</title>
- <content>
- <para>
- For your Connector/NET application to connect to a MySQL database
- it needs to establish a connection. This is achieved through the
- use of a <literal>MySqlConnection</literal> object.
- </para>
- <para>
- The MySqlConnection constructor takes a connection string as one
- of its parameters. The connection string provides necessary
- information to make the connection to the MySQL database. The
- connection string is discussed more fully in
- <link xlink:href="8b7d06e8-0177-4dd0-acca-f9c9caaa1072#connector-net-programming-connecting">Connecting to MySQL Using Connector/NET</link>. A
- reference containing a list of supported connection string options
- can also be found in
- <link xlink:href="c26b6c1a-1652-4d9d-ac74-96cee9531a3b"></link>.
- </para>
- <para>
- The following code shows how to create a connection object.
- </para>
- <code>using System;
-using System.Data;
-
-using MySql.Data;
-using MySql.Data.MySqlClient;
-
-public class Tutorial1
-{
- public static void Main()
- {
- string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
- MySqlConnection conn = new MySqlConnection(connStr);
- try
- {
- Console.WriteLine("Connecting to MySQL...");
- conn.Open();
- // Perform databse operations
- conn.Close();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.ToString());
- }
- Console.WriteLine("Done.");
- }
-}</code>
- <para>
- When the <literal>MySqlConnection</literal> constructor is invoked
- it returns a connection object, which is used for subsequent
- database operations. The first operation in this example is to
- open the connection. This needs to be done before further
- operations take place. Before the application exits the connection
- to the database needs to be closed by calling
- <literal>Close</literal> on the connection object.
- </para>
- <para>
- Sometimes an attempt to perform an <literal>Open</literal> on a
- connection object can fail, this will generate an exception that
- can be handled via standard exception handling code.
- </para>
- <para>
- In this section you have learned how to create a connection to a
- MySQL database, and open and close the corresponding connection
- object.
- </para>
- </content>
- </section>
- <section address="connector-net-programming-tutorial-sql-command">
- <title>The MySqlCommand Object</title>
- <content>
- <para>
- Once a connection has been established with the MySQL database,
- the next step is do carry out the desired database operations.
- This can be achieved through the use of the
- <literal>MySqlCommand</literal> object.
- </para>
- <para>
- You will see how to create a <literal>MySqlCommand</literal>
- object. Once it has been created there are three main methods of
- interest that you can call:
- </para>
- <list class="bullet">
- <listItem>
- <para>
- <legacyBold>ExecuteReader</legacyBold> - used to query
- the database. Results are usually returned in a
- <literal>MySqlDataReader</literal> object, created by
- <literal>ExecuteReader</literal>.
- </para>
- </listItem>
- <listItem>
- <para>
- <legacyBold>ExecuteNonQuery</legacyBold> - used to
- insert and delete data.
- </para>
- </listItem>
- <listItem>
- <para>
- <legacyBold>ExecuteScalar</legacyBold> - used to
- return a single value.
- </para>
- </listItem>
- </list>
- <para>
- Once a <literal>MySqlCommand</literal> object has been created,
- you will call one of the above methods on it to carry out a
- database operation, such as perform a query. The results are
- usually returned into a <literal>MySqlDataReader</literal> object,
- and then processed, for example the results might be displayed.
- The following code demonstrates how this could be done.
- </para>
- <code>using System;
-using System.Data;
-
-using MySql.Data;
-using MySql.Data.MySqlClient;
-
-public class Tutorial2
-{
- public static void Main()
- {
- string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
- MySqlConnection conn = new MySqlConnection(connStr);
- try
- {
- Console.WriteLine("Connecting to MySQL...");
- conn.Open();
-
- string sql = "SELECT Name, HeadOfState FROM Country WHERE Continent='Oceania'";
- MySqlCommand cmd = new MySqlCommand(sql, conn);
- MySqlDataReader rdr = cmd.ExecuteReader();
-
- while (rdr.Read())
- {
- Console.WriteLine(rdr[0]+" -- "+rdr[1]);
- }
-
- rdr.Close();
- conn.Close();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.ToString());
- }
- Console.WriteLine("Done.");
- }
-}</code>
- <para>
- When a connection has been created and opened, the code then
- creates a <literal>MySqlCommand</literal> object. Note that the
- SQL query to be executed is passed to the
- <literal>MySqlCommand</literal> constructor. The
- <literal>ExecuteReader</literal> method is then used to generate a
- <literal>MySqlReader</literal> object. The
- <literal>MySqlReader</literal> object contains the results
- generated by the SQL executed on the command object. Once the
- results have been obtained in a <literal>MySqlReader</literal>
- object, the results can be processed. In this case the information
- is simply printed out as part of a <literal>while</literal> loop.
- Finally, the <literal>MySqlReader</literal> object is displosed of
- by running its <literal>Close</literal> method on it.
- </para>
- <para>
- In the next example you will see how to use the
- <literal>ExecuteNonQuery</literal> method.
- </para>
- <para>
- The procedure for performing an <literal>ExecuteNonQuery</literal>
- method call is simpler, as there is no need to create an object to
- store results. This is because <literal>ExecuteNonQuery</literal>
- is only used for inserting, updating and deleting data. The
- following example illustrates a simple update to the Country
- table:
- </para>
- <code>using System;
-using System.Data;
-
-using MySql.Data;
-using MySql.Data.MySqlClient;
-
-public class Tutorial3
-{
- public static void Main()
- {
- string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
- MySqlConnection conn = new MySqlConnection(connStr);
- try
- {
- Console.WriteLine("Connecting to MySQL...");
- conn.Open();
-
- string sql = "INSERT INTO Country (Name, HeadOfState, Continent) VALUES ('Disneyland','Mickey Mouse', 'North America')";
- MySqlCommand cmd = new MySqlCommand(sql, conn);
- cmd.ExecuteNonQuery();
-
- conn.Close();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.ToString());
- }
- Console.WriteLine("Done.");
- }
-}</code>
- <para>
- The query is constructed, the command object created and the
- <literal>ExecuteNonQuery</literal> method called on the command
- object. You can access your MySQL database with the MySQL Client
- program and verify that the update was carried out correctly.
- </para>
- <para>
- Finally, you will see how the <literal>ExecuteScalar</literal>
- method can be used to return a single value. Again, this is
- straightforward, as a <literal>MySqlDataReader</literal> object is
- not required to store results, a simple variable will do. The
- following code illustrates how to use
- <literal>ExecuteScalar</literal>:
- </para>
- <code>using System;
-using System.Data;
-
-using MySql.Data;
-using MySql.Data.MySqlClient;
-
-public class Tutorial4
-{
- public static void Main()
- {
- string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
- MySqlConnection conn = new MySqlConnection(connStr);
- try
- {
- Console.WriteLine("Connecting to MySQL...");
- conn.Open();
-
- string sql = "SELECT COUNT(*) FROM Country";
- MySqlCommand cmd = new MySqlCommand(sql, conn);
- object result = cmd.ExecuteScalar();
- if (result != null)
- {
- int r = Convert.ToInt32(result);
- Console.WriteLine("Number of countries in the World database is: " + r);
- }
-
- conn.Close();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.ToString());
- }
- Console.WriteLine("Done.");
- }
-}</code>
- <para>
- This example uses a simple query to count the rows in the Country
- table. The result is obtained by calling
- <literal>ExecuteScaler</literal> on the command object.
- </para>
- </content>
- </section>
- <section address="connector-net-programming-tutorial-data-adapter">
- <title>Working with Decoupled Data</title>
- <content>
- <para>
- Previously, when using MySqlDataReader, the connection to the
- database was continually maintained, unless explicitly closed. It
- is also possible to work in a manner where a connection is only
- established when needed. For example, in this mode, a connection
- could be established in order to read a chunk of data, the data
- could then be modified by the application as required. A
- connection could then be reestablished only if and when the
- application needs to write data back to the database. This
- decouples the working data set from the database.
- </para>
- <para>
- This decouple mode of working with data is supported by
- Connector/NET. There are several parts involved in allowing this
- method to work:
- </para>
- <list class="bullet">
- <listItem>
- <para>
- <legacyBold>Data Set</legacyBold> - The Data Set is
- the area in which data is loaded in order to read or modify
- it. A <literal>DataSet</literal> object is instantiated, which
- can store multiple tables of data.
- </para>
- </listItem>
- <listItem>
- <para>
- <legacyBold>Data Adapter</legacyBold> - The Data
- Adapter is the interface between the Data Set and the database
- itself. The Data Adapter is responsible for efficiently
- managing connections to the database, opening and closing them
- as required. The Data Adapter is created by instantiating an
- object of the <literal>MySqlDataAdapter</literal> class. The
- <literal>MySqlDataAdapter</literal> object has two main
- methods: <literal>Fill</literal> which reads data into the
- Data Set, and <literal>Update</literal>, which writes data
- from the Data Set to the database.
- </para>
- </listItem>
- <listItem>
- <para>
- <legacyBold>Command Builder</legacyBold> - The Command
- Builder is a support object. The Command Builder works in
- conjunction with the Data Adapter. When a
- <literal>MySqlDataAdapter</literal> object is created it is
- typically given an initial SELECT statement. From this SELECT
- statement the Command Builder can work out the corresponding
- INSERT, UPDATE and DELETE statements that would be required
- should the database need to be updated. To create the Command
- Builder an object of the class
- <literal>MySqlCommandBuilder</literal> is created.
- </para>
- </listItem>
- </list>
- <para>
- Each of these classes will now be discussed in more detail.
- </para>
- <para>
- <legacyBold>Instantiating a DataSet object</legacyBold>
- </para>
- <para>
- A <literal>DataSet</literal> object can be created simply, as
- shown in the following example code snippet:
- </para>
- <code>DataSet dsCountry;
-...
-dsCountry = new DataSet();</code>
- <para>
- Although this creates the <literal>DataSet</literal> object it has
- not yet filled it with data. For that a Data Adapter is required.
- </para>
- <para>
- <legacyBold>Instantiating a MySqlDataAdapter
- object</legacyBold>
- </para>
- <para>
- The <literal>MySqlDataAdapter</literal> can be created as
- illustrated by the following example:
- </para>
- <code>MySqlDataAdapter daCountry;
-...
-string sql = "SELECT Code, Name, HeadOfState FROM Country WHERE Continent='North America'";
-daCountry = new MySqlDataAdapter (sql, conn);</code>
- <para>
- Note, the <literal>MySqlDataAdapter</literal> is given the SQL
- specifying the data you wish to work with.
- </para>
- <para>
- <legacyBold>Instantiating a MySqlCommandBuilder
- object</legacyBold>
- </para>
- <para>
- Once the <literal>MySqlDataAdapter</literal> has been created, it
- is necessary to generate the additional statements required for
- inserting, updating and deleting data. There are several ways to
- do this, but in this tutorial you will see how this can most
- easily be done with <literal>MySqlCommandBuilder</literal>. The
- following code snippet ilustrates how this is done:
- </para>
- <codeInline>MySqlCommandBuilder cb = new MySqlCommandBuilder(daCountry);</codeInline>
- <para>
- Note that the <literal>MySqlDataAdapter</literal> object is passed
- as a parameter to the command builder.
- </para>
- <para>
- <legacyBold>Filling the Data Set</legacyBold>
- </para>
- <para>
- In order to do anything useful with the data from your datbase,
- you need to load it into a Data Set. This is one of the jobs of
- the <literal>MySqlDataAdapter</literal> object, and is carried out
- with its <literal>Fill</literal> method. The following example
- code illustrates this:
- </para>
- <code>DataSet dsCountry;
-...
-dsCountry = new DataSet();
-...
-daCountry.Fill(dsCountry, "Country");</code>
- <para>
- Note the <literal>Fill</literal> method is a
- <literal>MySqlDataAdapter</literal> method, the Data Adapter knows
- how to establish a connec tion with the database and retrieve the
- required data, and then populates the Data Set when the
- <literal>Fill</literal> method is called. The second parameter
- is the table in the Data Set to update.
- </para>
- <para>
- <legacyBold>Updating the Data Set</legacyBold>
- </para>
- <para>
- The data in the Data Set can now be manipulated by the application
- as required. At some point, changes to data will need to be
- written back to the database. This is achieved through a
- <literal>MySqlDataAdapter</literal> method, the
- <literal>Update</literal> method.
- </para>
- <code>
-daCountry.Update(dsCountry, "Country");
-</code>
- <para>
- Again, the Data Set and the table within the Data Set to update
- are specified.
- </para>
- <para>
- <legacyBold>Working Example</legacyBold>
- </para>
- <para>
- The interactions between the <literal>DataSet</literal>,
- <literal>MySqlDataAdapter</literal> and
- <literal>MySqlCommandBuilder</literal> classes can be a little
- confusing, so their operation can perhaps be best illustrated by
- working code.
- </para>
- <para>
- In this example, data from the World database is read into a Data
- Grid View control. Here, the data can be viewed and changed before
- clicking an update button. The update button then activates code
- to write changes back to the database. The code uses the
- principles explained above. The application was built using the
- Microsoft Visual Studio in order to place and create the user
- interface controls, but the main code that uses the key classes
- descibed above is shown below, and is portable.
- </para>
- <code>using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-
-using MySql.Data;
-using MySql.Data.MySqlClient;
-
-namespace WindowsFormsApplication5
-{
- public partial class Form1 : Form
- {
- MySqlDataAdapter daCountry;
- DataSet dsCountry;
-
- public Form1()
- {
- InitializeComponent();
- }
-
- private void Form1_Load(object sender, EventArgs e)
- {
-
- string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
- MySqlConnection conn = new MySqlConnection(connStr);
- try
- {
- label2.Text = "Connecting to MySQL...";
-
- string sql = "SELECT Code, Name, HeadOfState FROM Country WHERE Continent='North America'";
- daCountry = new MySqlDataAdapter (sql, conn);
- MySqlCommandBuilder cb = new MySqlCommandBuilder(daCountry);
-
- dsCountry = new DataSet();
- daCountry.Fill(dsCountry, "Country");
- dataGridView1.DataSource = dsCountry;
- dataGridView1.DataMember = "Country";
- }
- catch (Exception ex)
- {
- label2.Text = ex.ToString();
- }
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- daCountry.Update(dsCountry, "Country");
- label2.Text = "MySQL Database Updated!";
- }
-
- }
-}</code>
- <para>
- The application running is shown below:
- </para>
- <mediaLink>
- <para />
- <caption>World Database Application</caption>
- <image xlink:href="connector-net-programming-tutorial-1" />
- </mediaLink>
- <para />
- </content>
- </section>
- <section address="connector-net-programming-tutorial-parameters">
- <title>Working with Parameters</title>
- <content>
- <para>
- This part of the tutorial shows you how to use parameters in your
- Connector/NET application.
- </para>
- <para>
- Although it is possible to build SQL query strings directly from
- user input, this is not advisable as it does not prevent from
- erroneous or malicious information being entered. It is safer to
- use parameters as they will be processed as field data only. For
- example, imagine the following query was contructed from user
- input:
- </para>
- <codeInline>string sql = "SELECT Name, HeadOfState FROM Country WHERE Continent = "+user_continent;</codeInline>
- <para>
- If the string <literal>user_continent</literal> came from a Text
- Box control, there would potentially be no control over the string
- enetred by the user. The user could enter a string that generates
- a run time error, or in the worst case actually harms the system.
- When using parameters it is not possible to do this because a
- parameter is only ever treated as a field parameter, rather than
- an arbitrary piece of SQL code.
- </para>
- <para>
- The same query written user a parameter for user input would be:
- </para>
- <codeInline>string sql = "SELECT Name, HeadOfState FROM Country WHERE Continent = @Continent";</codeInline>
- <para>
- Note that the parameter is preceded by an '@' symbol to indicate
- it is to be treated as a parameter.
- </para>
- <para>
- As well as marking the position of the parameter in the query
- string, it is necessary to create a parameter object that can be
- passed to the Command object. In Connector/NET the class
- <literal>MySqlParameter</literal> is used for this purpose. The
- use of <literal>MySqlParameter</literal> is best illustrated by a
- small code snippet:
- </para>
- <code>MySqlParameter param = new MySqlParameter();
-param.ParameterName = "@Continent";
-param.Value = "North America";
-cmd.Parameters.Add(param);</code>
- <para>
- In this example the string "North America" is supplied as the
- parameter value statically, but in a more practical example it
- would come from a user input control. Once the parameter has its
- name and value set it needs to be added to the Command object
- using the <literal>Add</literal> method.
- </para>
- <para>
- A further example illustrates this:
- </para>
- <code>using System;
-using System.Data;
-
-using MySql.Data;
-using MySql.Data.MySqlClient;
-
-public class Tutorial5
-{
- public static void Main()
- {
- string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
- MySqlConnection conn = new MySqlConnection(connStr);
- try
- {
- Console.WriteLine("Connecting to MySQL...");
- conn.Open();
-
- string sql = "SELECT Name, HeadOfState FROM Country WHERE Continent=@Continent";
- MySqlCommand cmd = new MySqlCommand(sql, conn);
-
- Console.WriteLine("Enter a continent e.g. 'North America', 'Europe': ");
- string user_input = Console.ReadLine();
-
- MySqlParameter param = new MySqlParameter();
- param.ParameterName = "@Continent";
- param.Value = user_input;
- cmd.Parameters.Add(param);
-
- MySqlDataReader rdr = cmd.ExecuteReader();
-
- while (rdr.Read())
- {
- Console.WriteLine(rdr["Name"]+" --- "+rdr["HeadOfState"]);
- }
-
- conn.Close();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.ToString());
- }
- Console.WriteLine("Done.");
- }
-}</code>
- <para>
- In this part of the tutorial you have see how to use parameters to
- make your code more secure.
- </para>
- </content>
- </section>
- <section address="connector-net-programming-tutorial-stored-procedures">
- <title>Working with Stored Procedures</title>
- <content>
- <para>
- In this section you will see how to work with Stored Procedures.
- This section assumes you have a basic understanding of what a
- Stored Procedure is, and how to create one.
- </para>
- <para>
- For the purposes of this tutorial, you will create a simple Stored
- Procedure to see how it can be called from Connector/NET. In the
- MySQL Client program, connect to the World database and enter the
- following Stored Procedure:
- </para>
- <code>DELIMITER //
-CREATE PROCEDURE country_hos
-(IN con CHAR(20))
-BEGIN
- SELECT Name, HeadOfState FROM Country
- WHERE Continent = con;
-END //
-DELIMITER ;</code>
- <para>
- Test the Stored Procedure wors as expec ted by typing the
- following into the MySQL Client program:
- </para>
- <codeInline>CALL country_hos('Europe');</codeInline>
- <para>
- Note that The Stored Routine takes a single parameter, which is
- the continent you wish to restrict your search to.
- </para>
- <para>
- Having confirmed that the Stored Procedure is present and correct
- you can now move on to seeing how it can be accessed from
- Connector/NET.
- </para>
- <para>
- Calling a Stored Procedure from your Connector/NET application is
- similar to techniques you have seen earlier in this tutorial. A
- <literal>MySqlCommand</literal> object is created, but rather than
- taking a SQL query as a parameter it takes the name of the Stored
- Procedure to call. The <literal>MySqlCommand</literal> object also
- needs to be set to the type of Stored Procedure. This is
- illustrated by the following code snippet:
- </para>
- <code>string rtn = "country_hos";
-MySqlCommand cmd = new MySqlCommand(rtn, conn);
-cmd.CommandType = CommandType.StoredProcedure;</code>
- <para>
- In this case you also need to pass a parameter to the Stored
- Procedure. This can be achieved using the techniques seen in the
- previous section on parameters,
- <link xlink:href="34e3033f-b986-4073-95c8-945f73aa79b0#connector-net-programming-tutorial-parameters">Working with Parameters</link>.
- This is shown in the following code snippet:
- </para>
- <code>MySqlParameter param = new MySqlParameter();
-param.ParameterName = "@con";
-param.Value = "Europe";
-cmd.Parameters.Add(param);</code>
- <para>
- The value of the parameter <literal>@con</literal> could more
- realistically have come from a user input control, but for
- simplicity it is set as a static string in this example.
- </para>
- <para>
- At this point everything is set up and all that now needs to be
- done is to call the routine. This can be achieved using techniques
- also learned in earlier sections, but in this case the
- <literal>ExecuteReader</literal> method of the
- <literal>MySqlCommand</literal> object is used.
- </para>
- <para>
- Complete working code for the Stored Procedure example is shown
- below:
- </para>
- <code>using System;
-using System.Data;
-
-using MySql.Data;
-using MySql.Data.MySqlClient;
-
-public class Tutorial6
-{
- public static void Main()
- {
- string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
- MySqlConnection conn = new MySqlConnection(connStr);
- try
- {
- Console.WriteLine("Connecting to MySQL...");
- conn.Open();
-
- string rtn = "country_hos";
- MySqlCommand cmd = new MySqlCommand(rtn, conn);
- cmd.CommandType = CommandType.StoredProcedure;
- MySqlParameter param = new MySqlParameter();
- param.ParameterName = "@con";
- param.Value = "Europe";
- cmd.Parameters.Add(param);
-
- MySqlDataReader rdr = cmd.ExecuteReader();
- while (rdr.Read())
- {
- Console.WriteLine(rdr[0] + " --- " + rdr[1]);
- }
- conn.Close();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.ToString());
- }
- Console.WriteLine("Done.");
- }
-}</code>
- <para>
- In this section you have seen how to call a Stored Procedure from
- Connector/NET. For the moment, this concludes our introductory
- tutorial on programming with Connector/NET.
- </para>
- </content>
- </section>
- </developerConceptualDocument>
-</topic>
\ No newline at end of file
=== modified file 'Documentation/Users Guide/connector-net-programming.aml'
--- a/Documentation/Users Guide/connector-net-programming.aml 2009-09-08 17:12:22 +0000
+++ b/Documentation/Users Guide/connector-net-programming.aml 2009-12-15 21:58:48 +0000
@@ -343,6 +343,113 @@
</code>
</content>
</section>
+ <section address="connector-net-programming-mysqlcommand">
+ <title>Using MySqlCommand</title>
+ <content>
+ <para>
+ A MySqlCommand has the <literal>CommandText</literal> and
+ <literal>CommandType</literal> properties associated with it. The
+ <literal>CommandText</literal> will be handled differently
+ depending on the setting of <literal>CommandType</literal>.
+ <literal>CommandType</literal> can be one of:
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ Text - A SQL text command (default)
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ StoredProcedure - The name of a Stored Procedure
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ TableDirect - The name of a table (new in Connector/NET 6.2)
+ </para>
+ </listItem>
+ </list>
+ <para>
+ The default <literal>CommandType</literal>,
+ <literal>Text</literal>, is used for executing queries and other
+ SQL commands. Some example of this can be found in the following
+ section <link xlink:href="34e3033f-b986-4073-95c8-945f73aa79b0#connector-net-tutorials-sql-command">The MySqlCommand Object</link>.
+ </para>
+ <para>
+ If <literal>CommandType</literal> is set to
+ <literal>StoredProcedure</literal>, <literal>CommandText</literal>
+ should be set to the name of the Stored Procedure to access.
+ </para>
+ <para>
+ If <literal>CommandType</literal> is set to
+ <literal>TableDirect</literal>, all rows and columns of the named
+ table will be returned when you call one of the Execute methods.
+ In effect, this command performs a <literal>SELECT *</literal> on
+ the table specified. The <literal>CommandText</literal> property
+ is set to the name of the table you wish to query. This is
+ illustrated by the following code snippet:
+ </para>
+ <code>...
+MySqlCommand cmd = new MySqlCommand();
+cmd.CommandText = "mytable";
+cmd.Connection = someConnection;
+cmd.CommandType = CommandType.TableDirect;
+SqlDataReader reader = cmd.ExecuteReader();
+while (reader.Read())
+{
+ Console.WriteLn(reader[0], reader[1]...);
+}
+...</code>
+ <para>
+ Examples of using the CommandType of StoredProcedure can be found
+ in the section
+ <link xlink:href="8b7d06e8-0177-4dd0-acca-f9c9caaa1072#connector-net-programming-stored-calling">Calling a Stored Procedure from Connector/NET</link>.
+ </para>
+ <para>
+ Commands can have a timeout associated with them. This is useful
+ as you may not want a situation were a command takes up an
+ excessive amount of time. A timeout can be set using the
+ <literal>CommandTimeout</literal> property. The following code
+ snippet sets a timeout of one minute:
+ </para>
+ <code>
+MySqlCommand cmd = new MySqlCommand();
+cmd.CommandTimeout = 60;
+</code>
+ <para>
+ The default value is 30 secs. A value of 0 indicates an indefinite
+ wait and should be avoided. Note the default command timeout can
+ be changed using the connection string option <literal>Default
+ Command Timeout</literal>.
+ </para>
+ <para>
+ Prior to 6.2,
+ <literal>MySqlCommand.CommandTimeout</literal> included user
+ processing time, that is processing time not related to direct use
+ of the connector. Timeout was implemented through a .NET Timer,
+ that triggered after <literal>CommandTimeout</literal> seconds.
+ This timer consumed a thread.
+ </para>
+ <para>
+ 6.2 introduced timeouts that are aligned with how Microsoft
+ handles <literal>SqlCommand.CommandTimeout</literal>. This
+ property is the cumulative timeout for all network reads and
+ writes during command execution or processing of the results. A
+ timeout can still occur in the <literal>MySqlReader.Read</literal>
+ method after the first row is returned, and does not include user
+ processing time, only IO operations. The 6.2 implementation uses
+ the underlying stream timeout facility, so is more efficient in
+ that it does not require the additional timer thread as was the
+ case with the previous implementation.
+ </para>
+ <para>
+ Further details on this can be found in the relevant
+ <externalLink><linkText>Microsoft
+ documentation</linkText><linkUri>http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout.aspx</linkUri></externalLink>.
+ </para>
+ </content>
+ </section>
<section address="connector-net-programming-connection-pooling">
<title>Using Connector/NET with Connection Pooling</title>
<content>
@@ -390,6 +497,22 @@
<literal>MySqlHelper</literal> class. These take a connection
string as an argument, and they fully support connection pooling.
</para>
+ <para>
+ Starting with 6.2, there is a background job that runs
+ every three minutes and removes connections from pool that have
+ been idle (unused) for more than three minutes. The pool cleanup
+ frees resources on both client and server side. This is because on
+ the client side every connection uses a socket, and on the server
+ side every connection uses a socket and a thread.
+ </para>
+ <para>
+ Prior to this change, connections were never removed from the
+ pool, and the pool always contained the peak number of open
+ connections. For example, a web application that peaked at 1000
+ concurrent database connections would consume 1000 threads and
+ 1000 open sockets at the server, without ever freeing up those
+ resources from the connection pool.
+ </para>
</content>
</section>
<section address="connector-net-programming-prepared">
@@ -1573,9 +1696,7 @@
<literal>MySqlDateTime</literal> object for invalid dates, add
the following line to your connection string:
</para>
- <code>
- Allow Zero Datetime=True
- </code>
+ <codeInline>Allow Zero Datetime=True</codeInline>
<para>
Please note that the use of the <literal>MySqlDateTime</literal>
class can still be problematic. The following are some known
@@ -1685,9 +1806,12 @@
</listItem>
</list>
<para>
- The following table shows the supported providers, their default
- provider and the corresponding MySQL provider:
+ The following tables show the supported providers, their default
+ provider and the corresponding MySQL provider.
</para>
+ <para>
+ <legacyBold>Membership Provider</legacyBold>
+ </para>
<table>
<row>
<entry>
@@ -1710,6 +1834,9 @@
</entry>
</row>
</table>
+ <para>
+ <legacyBold>Role Provider</legacyBold>
+ </para>
<table>
<row>
<entry>
@@ -1732,6 +1859,9 @@
</entry>
</row>
</table>
+ <para>
+ <legacyBold>Profile Provider</legacyBold>
+ </para>
<table>
<row>
<entry>
@@ -1754,6 +1884,9 @@
</entry>
</row>
</table>
+ <para>
+ <legacyBold>SessionState Provider</legacyBold>
+ </para>
<table>
<row>
<entry>
@@ -1779,7 +1912,7 @@
<alert class="note">
<para>
The MySQL Session State provider uses slightly different
- capitilzation on the class name compared to the other MySQL
+ capitalization on the class name compared to the other MySQL
providers.
</para>
</alert>
@@ -1904,7 +2037,7 @@
<para>
A tutorial demonstrating how to use the Membership and Role
Providers can be found in the following section
- <link xlink:href="8b7d06e8-0177-4dd0-acca-f9c9caaa1072#connector-net-programming-tutorial-asp-roles">Tutorial: ASP.NET Membership and Role Provider</link>.
+ <link xlink:href="34e3033f-b986-4073-95c8-945f73aa79b0#connector-net-tutorials-asp-roles">Tutorial: ASP.NET Membership and Role Provider</link>.
</para>
<para>
<legacyBold> Deployment</legacyBold>
@@ -2041,778 +2174,143 @@
</para>
</content>
</section>
- <section address="connector-net-programming-tutorial-asp-roles">
- <title>Tutorial: ASP.NET Membership and Role Provider</title>
- <content>
- <para>
- Many web sites feature the facility for the user to create a user
- account. They can then log into the web site and enjoy a
- personalized experience. This requires that the developer creates
- database tables to store user information, along with code to
- gather and process this data. This represents a burden on the
- developer, and there is the possibility for security issues to
- creep into the developed code. However, ASP.NET 2.0 introduced the
- Membership system. This system is designed around the concept of
- Membership, Profile and Role Providers, which together provide all
- of the functionality to implement a user system, that previously
- would have to have been created by the developer from scratch.
- </para>
- <para>
- Currently, provides Membership, Role, Profile and Session
- State Providers.
- </para>
- <para>
- This tutorial shows you how to set up your ASP.NET web application
- to use the Membership and Role Providers. It assumes that
- you have MySQL Server installed, along with and Microsoft
- Visual Studio. This tutorial was tested with 6.0.4 and
- Microsoft Visual Studio 2008 Professional Edition.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- Create a new database in the MySQL Server using the MySQL
- Command Line Client program (<literal>mysql</literal>), or
- other suitable tool. It does not matter what name is used for
- the database, but it should be noted down so that it can be
- specified in the connection string constructed later in this
- tutorial. This database will contain the tables, automatically
- created for you later, used to store data about users and
- roles.
- </para>
- </listItem>
- <listItem>
- <para>
- Create a new ASP.NET Web Site in Visual Studio. If you are not
- sure how to do this, refer to the following tutorial:
- <link xlink:href="9f3f194e-ad35-4379-b04d-5dce4b34ce6a#connector-net-visual-studio-entity-framework-tutorial-databinding-linq-entities">Tutorial: Databinding in ASP.NET using LINQ on Entities</link>,
- which demonstrates how to create a simple ASP.NET web site.
- </para>
- </listItem>
- <listItem>
- <para>
- Add References to <literal>MySql.Data</literal> and
- <literal>MySql.Web</literal> to the web site project.
- </para>
- </listItem>
- <listItem>
- <para>
- Locate the <legacyBold>machine.config</legacyBold> file on your
- system, which is the configuration file for the .NET
- Framework.
- </para>
- </listItem>
- <listItem>
- <para>
- Search the <legacyBold>machine.config</legacyBold> file to find
- the membership provider
- <literal>MySQLMembershipProvider</literal>.
- </para>
- </listItem>
- <listItem>
- <para>
- Add the attribute
- <literal>autogenerateschema="true"</literal>. The appropriate
- section should now resemble the following (note: for the sake
- of brevity some information has been excluded):
- </para>
- <code><membership>
- <providers>
- <add name="AspNetSqlMembershipProvider"
- type="System.Web.Security.SqlMembershipProvider"
- ...
- connectionStringName="LocalSqlServer"
- ... />
- <add name="MySQLMembershipProvider"
- autogenerateschema="true"
- type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.0.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
- connectionStringName="LocalMySqlServer"
- ... />
- </providers>
-</membership></code>
- <para>
- Note that the name for the connection string to be used to
- connect to the server that contains the membership database is
- <literal>LocalMySqlServer</literal>.
- </para>
- <para>
- The <literal>autogenerateschema="true"</literal> attribute
- will cause to silently create, or upgrade, the schema
- on the database server, to contain the required tables for
- storing membership information.
- </para>
- </listItem>
- <listItem>
- <para>
- It is now necessary to create the connection string referenced
- in the previous step. Load the web site's
- <legacyBold>web.config</legacyBold> file into Visual Studio.
- </para>
- </listItem>
- <listItem>
- <para>
- Locate the section marked
- <literal><connectionStrings></literal>. Add the
- following connection string information:
- </para>
- <code><connectionStrings>
- <remove name="LocalMySqlServer"/>
- <add name="LocalMySqlServer"
- connectionString="Datasource=localhost;Database=users;uid=root;pwd=password;"
- providerName="MySql.Data.MySqlClient"/>
-</connectionStrings></code>
- <para>
- The database specified is the one created in the first step.
- You could alternatively have used an existing database.
- </para>
- </listItem>
- <listItem>
- <para>
- At this point build the solution to ensure no errors are
- present. This can be done by selecting
- <ui>Build</ui>, <ui>Build Solution</ui>
- from the main menu, or pressing .
- </para>
- </listItem>
- <listItem>
- <para>
- ASP.NET supports the concept of locally and remotely
- authenticated users. With local authentication the user is
- validated using their Windows credentials when they attempt to
- access the web site. This can be useful in an Intranet
- environment. With remote authentication a user is prompted for
- their login details when accessing the web site, and these
- credentials are checked aganst the membership information
- stored in a database server such as MySQL Server. You will now
- see how to choose this form of authentication.
- </para>
- <para>
- Start the ASP.NET Web Site Administration Tool. This can be
- done quickly by clicking the small hammer/Earth icon in the
- Solution Explorer. You can also launch this tool by selecting
- <ui>Website</ui>, <ui>ASP.NET
- Configuration</ui> from the main menu.
- </para>
- </listItem>
- <listItem>
- <para>
- In the ASP.NET Web Site Administration Tool click the
- tab.
- </para>
- </listItem>
- <listItem>
- <para>
- Now click the
- link.
- </para>
- </listItem>
- <listItem>
- <para>
- Select the radio
- button. The web site will now need to provide a form to allow
- the user to enter their login details. These will be checked
- against membership information stored in the MySQL database.
- </para>
- <mediaLink>
- <para />
- <caption>Authentication Type</caption>
- <image xlink:href="connector-net-programming-tutorial-authentication-type" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- You now need to specify the Role and Membership Provider to be
- used. Click the tab.
- </para>
- </listItem>
- <listItem>
- <para>
- Click the link.
- </para>
- </listItem>
- <listItem>
- <para>
- Now select the
- and the radio buttons.
- </para>
- <mediaLink>
- <para />
- <caption>Select Membership and Role Provider</caption>
- <image xlink:href="connector-net-programming-tutorial-select-provider" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- In Visual Studio rebuild the solution by selecting
- <ui>Build</ui>, <ui>Rebuild Solution</ui>
- from the main menu.
- </para>
- </listItem>
- <listItem>
- <para>
- Check that the necessary schema has been created. This can be
- achieved using the MySQL Command Line Client program.
- </para>
- <mediaLink>
- <para />
- <caption>Membership and Role Provider Tables</caption>
- <image xlink:href="connector-net-programming-tutorial-tables" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- Assuming all is present and correct you can now create users
- and roles for your web application. The easiest way to do this
- is with the ASP.NET Web Site Administration Tool. However,
- many web applications contain their own modules for creating
- roles and users. For simplicity the ASP.NET Web Site
- Administration Tool will be used in this tutorial.
- </para>
- </listItem>
- <listItem>
- <para>
- In the ASP.NET Web Site Administration Tool click on the
- tab. Now that both the
- Membership and Role Provider are enabled you will see links
- for creating roles and users. Click the link.
- </para>
- <mediaLink>
- <para />
- <caption>Security Tab</caption>
- <image xlink:href="connector-net-programming-tutorial-security-tab" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- You can now enter the name of a new Role and click
- <math>Add Role</math> to create the new Role. Create
- new Roles as required.
- </para>
- </listItem>
- <listItem>
- <para>
- Click the <math>Back</math> button.
- </para>
- </listItem>
- <listItem>
- <para>
- Click the link. You can now
- fill in information about the user to be created, and also
- allocate that user to one or more Roles.
- </para>
- <mediaLink>
- <para />
- <caption>Create User</caption>
- <image xlink:href="connector-net-programming-tutorial-create-user" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- Using the MySQL Command Line Client program you can check that
- your database has been correctly populated with the Membership
- and Role data.
- </para>
- <mediaLink>
- <para />
- <caption>Membership and Roles Table Contents</caption>
- <image xlink:href="connector-net-programming-tutorial-users-roles-tables" />
- </mediaLink>
- <para />
- </listItem>
- </list>
- <para>
- In this tutorial you have seen how to set up the Membership
- and Role Providers for use in your ASP.NET web application.
- </para>
- </content>
- </section>
- <section address="connector-net-programming-tutorial-asp-provider-session-state">
- <title>Tutorial: ASP.NET Session State Provider</title>
- <content>
- <para>
- from version 6.1 has included a MySQL Session State
- Provider. This provider allows you to store session state in a
- MySQL database. The following tutorial shows you how to prepare to
- use the MySQL Session State Provider, and then store session data
- into the MySQL database. This tutorial uses Microsoft Visual
- Studio 2008 Professional Edition, 6.1.1 and MySQL Server
- 5.1. This tutorial also assumes you have created an empty
- database, for example <literal>test</literal>, where you will
- store session data. You could do this using the MySQL Command Line
- Client tool.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- In Visual Studio create a new ASP.NET web site. If you are not
- sure how to do this refer to the tutorial
- <link xlink:href="9f3f194e-ad35-4379-b04d-5dce4b34ce6a#connector-net-visual-studio-entity-framework-tutorial-databinding-linq-entities">Tutorial: Databinding in ASP.NET using LINQ on Entities</link>
- which demonstrates how to do this.
- </para>
- </listItem>
- <listItem>
- <para>
- Launch the MySQL MySQL Website Configuration tool. Due to a
- bug in 6.1.1 this may not appear unless you are connected to a
- server in the Server Explorer. If you are unfamiliar with the
- MySQL Website Configuration tool it is suggested that you
- first work through the following tutorial
- <link xlink:href="9f3f194e-ad35-4379-b04d-5dce4b34ce6a#connector-net-website-config">MySQL Website Configuration Tool</link>.
- </para>
- </listItem>
- <listItem>
- <para>
- Navigate through the wizard to the Session State page. Make
- sure the checkbox is seected.
- </para>
- </listItem>
- <listItem>
- <para>
- On the same page configure the connection string to the
- database that will contain your session data. This database
- can be empty as will create the schema required to
- store session data.
- </para>
- </listItem>
- <listItem>
- <para>
- Ensure that the checkbox is selected so that will create the
- schema in your database to store the session data correctly.
- </para>
- </listItem>
- <listItem>
- <para>
- Enter the name of your application.
- </para>
- </listItem>
- <listItem>
- <para>
- Click <math>Finish</math>. The MySQL Website
- Configuration tool will now update your application's
- <legacyBold>web.config</legacyBold> file with information about
- the connection string and default providers to be used. In
- this case we have selected the MySQL Session State Provider.
- </para>
- </listItem>
- </list>
- <para>
- At this point you are ready to use the MySQL database to store
- session data. To test that the set up has worked you can write a
- simple program that uses session variables.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- Open <legacyBold>Default.aspx.cs</legacyBold>. In the Page_Load
- method add the following code:
- </para>
- <codeInline>Session["SessionVariable1"] = "Test string";</codeInline>
- </listItem>
- <listItem>
- <para>
- Build your solution.
- </para>
- </listItem>
- <listItem>
- <para>
- Run the solution (without debugging). When the application
- runs, the provider will autogenerate tables required in the
- database you chose when setting up the application.
- </para>
- </listItem>
- <listItem>
- <para>
- Check that the schema was in fact created. Using the MySQL
- Command Line Client use the target database and then type
- <literal>SHOW TABLES;</literal>. You will see that has
- created the required schema automatically, as we selected this
- to happen in the MySQL Website Configuration tool.
- </para>
- </listItem>
- <listItem>
- <para>
- Now view the contents of these tables by typing
- <literal>SELECT * FROM my_aspnet_sessions;</literal> in the
- MySQL Command Line Client. This will display the session data
- our application used. Note that this is stored in binary
- format so some data may not display as expected.
- </para>
- </listItem>
- </list>
- <para>
- At this point you have installed the Session State Provider and
- carried out a preliminary test of the installation. You will now
- work a bit more with the Session State Provider.
- </para>
- <para>
- In this part of the tutorial you will set and retrieve a session
- variable. You can work with your existing project.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- Select the <legacyBold>Default.aspx</legacyBold> and switch to
- Design View. Add a text box and three buttons. Change the text
- property for the buttons to , , and
- . These will be
- <literal>Button1</literal>, <literal>Button2</literal> and
- <literal>Button3</literal> respectively. Build your solution
- to ensure that no errors have been introduced.
- </para>
- </listItem>
- <listItem>
- <para>
- Still in the Design View, double click
- <literal>Button1</literal>. Now to the
- <literal>Button1_Click</literal> event handler add code some
- the handler resembles the following:
- </para>
- <code>
-protected void Button1_Click(object sender, EventArgs e)
-{
- Session["SessionString"] = TextBox1.Text;
-}
-</code>
- <para>
- You have created a new Session variable accessed using the key
- . This will be set to the text
- that was entered into the text box when
- <literal>Button1</literal> is clicked.
- </para>
- </listItem>
- <listItem>
- <para>
- In Design View double click <literal>Button2</literal> to add
- its click event handler. This button needs to clear text from
- the text box. The code to do this is as follows:
- </para>
- <code>
-protected void Button2_Click(object sender, EventArgs e)
-{
- TextBox1.Text = "";
-}
-</code>
- <para>
- The code simply assigns an empty string to the
- <literal>Text</literal> property of the text box.
- </para>
- </listItem>
- <listItem>
- <para>
- In the Desin View double click <literal>Button3</literal> and
- modify the click handler as follows:
- </para>
- <code>
-protected void Button3_Click(object sender, EventArgs e)
-{
- TextBox1.Text = (String)Session["SessionString"];
-}
-</code>
- <para>
- This will retrieve the session string and display it in the
- text box.
- </para>
- </listItem>
- <listItem>
- <para>
- Now modify the <literal>Page_Load</literal> method as follows:
- </para>
- <code>
-protected void Page_Load(object sender, EventArgs e)
-{
- if (!IsPostBack)
- {
- TextBox1.Text = "Enter some text";
- }
-}
-</code>
- <para>
- This ensures that when the page loads the text box
- <literal>Text</literal> property is reset.
- </para>
- </listItem>
- <listItem>
- <para>
- Ensure that the solution is saved and then rebuild the
- solution.
- </para>
- </listItem>
- <listItem>
- <para>
- Run the solution without debugging.
- </para>
- </listItem>
- <listItem>
- <para>
- The form will be displayed. Enter some text into the text box.
- Now click <math>Store Session Variable</math>. At
- this point you have stored the string in a session variable.
- </para>
- </listItem>
- <listItem>
- <para>
- Now click <math>Clear Text</math> to clear the text
- box.
- </para>
- </listItem>
- <listItem>
- <para>
- Now click <math>Show Session Variable</math> to
- retrieve and display the session variable.
- </para>
- </listItem>
- <listItem>
- <para>
- Refresh the page to destroy the form and display a new form.
- </para>
- </listItem>
- <listItem>
- <para>
- Click <math>Show Session Variable</math> the text
- box will display the stored session variable, demonstrating
- that the refreshing the page does not destroy the session
- variable.
- </para>
- </listItem>
- </list>
- <para>
- This illustrates that the session state data is not destroyed when
- a page is reloaded.
- </para>
- </content>
- </section>
- <section address="connector-net-programming-tutorial-asp-provider-profile">
- <title>Tutorial: ASP.NET Profile Provider</title>
- <content>
- <para>
- This tutorial shows you how to use the MySQL Profile Provider to
- store user profile information in a MySQL database. The tutorial
- uses 6.1.1, MySQL Server 5.1 and Microsoft Visual Studio
- 2008 Professional Edition.
- </para>
- <para>
- Many modern web sites allow the user to create a personal profile.
- This requires a significant amount of code, but ASP.NET reduces
- this considerable by including the functionality in its Profile
- classes. The Profile Provider provides an abstraction between
- these classes and a data source. The MySQL Profile Provider allows
- profile data to be stored in a MySQL database. This allows the
- profile properties to be written to a persistent store, and be
- retrieved when required. The Profile Provider also allows profile
- data to be managed effectively, for example it allows profiles
- that have not been accessed since a specific date to be deleted.
- </para>
- <para>
- The following steps show you how you can select the MySQL Profile
- Provider.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- Create a new ASP.NET web project.
- </para>
- </listItem>
- <listItem>
- <para>
- Select the MySQL Website Configuration tool. Due to a bug in
- 6.1.1 you may have to first connect to a server in Server
- Explorer before the tool's icon will display in the toolbar of
- the Solution Explorer.
- </para>
- </listItem>
- <listItem>
- <para>
- In the MySQL Website Configuration tool navigate through the
- tool to the Profiles page.
- </para>
- </listItem>
- <listItem>
- <para>
- Select the checkbox.
- </para>
- </listItem>
- <listItem>
- <para>
- Select the checkbox.
- </para>
- </listItem>
- <listItem>
- <para>
- Click the <math>Edit...</math> button and configure
- a connection string for the database that will be used to
- store user profile information.
- </para>
- </listItem>
- <listItem>
- <para>
- Navigate to the last page of the tool and click
- <math>Finish</math> to save your changes and exit
- the tool.
- </para>
- </listItem>
- </list>
- <para>
- At this point you are now ready to start using the MySQL Profile
- Provider. With the following steps you can carry out a preliminary
- test of your installation.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- Open your <legacyBold>web.config</legacyBold> file.
- </para>
- </listItem>
- <listItem>
- <para>
- Add a simple profile such as the following:
- </para>
- <code>
-<system.web>
- <anonymousIdentification enabled="true"/>
- <profile defaultProvider="MySQLProfileProvider">
- ...
- <properties>
- <add name="Name" allowAnonymous="true"/>
- <add name="Age" allowAnonymous="true" type="System.UInt16"/>
- <group name="UI">
- <add name="Color" allowAnonymous="true" defaultValue="Blue"/>
- <add name="Style" allowAnonymous="true" defaultValue="Plain"/>
- </group>
- </properties>
- </profile>
- ...
-</code>
- <para>
- Note that <literal>anonymousIdentification</literal> has been
- set to true. This allows users who have not been authenticated
- to use profiles. They are identified by a GUID in a cookie
- rather than by user name.
- </para>
- </listItem>
- </list>
- <para>
- Now that the simple profile has been defined in
- <legacyBold>web.config</legacyBold>, the next step is to write some
- code to test the profile.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- In Design View design a simple page with the following
- controls:
- </para>
- <mediaLink>
- <para />
- <caption>Simple Profile Application</caption>
- <image xlink:href="connector-net-programming-tutorial-asp-provider-profile-simple-app" />
- </mediaLink>
- <para />
- <para>
- These will allow the user to enter some profile information.
- The user can also use the buttons to save their profile, clear
- the page, and restore their profile data.
- </para>
- </listItem>
- <listItem>
- <para>
- In the Code View add code as follows:
- </para>
- <code>
-...
-protected void Page_Load(object sender, EventArgs e)
-{
- if (!IsPostBack)
- {
- TextBox1.Text = Profile.Name;
- TextBox2.Text = Profile.Age.ToString();
- Label1.Text = Profile.UI.Color;
- }
-}
-
-// Store Profile
-protected void Button1_Click(object sender, EventArgs e)
-{
- Profile.Name = TextBox1.Text;
- Profile.Age = UInt16.Parse(TextBox2.Text);
-}
-
-// Clear Form
-protected void Button2_Click(object sender, EventArgs e)
-{
- TextBox1.Text = "";
- TextBox2.Text = "";
- Label1.Text = "";
-}
-
-// Retrieve Profile
-protected void Button3_Click(object sender, EventArgs e)
-{
- TextBox1.Text = Profile.Name;
- TextBox2.Text = Profile.Age.ToString();
- Label1.Text = Profile.UI.Color;
-}
-
-protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
-{
- Profile.UI.Color = DropDownList1.SelectedValue;
-}
-...
-</code>
- </listItem>
- <listItem>
- <para>
- Save all files and build the solution to check that no errors
- have been introduced.
- </para>
- </listItem>
- <listItem>
- <para>
- Run the application.
- </para>
- </listItem>
- <listItem>
- <para>
- Enter your name, age and select a color from the listbox. Now
- store this information in your profile by clicking
- <math>Store Profile</math>. Note that if you do not
- select a color from the listbox your profile will use the
- default color <literal>Blue</literal> that was specified in
- the <legacyBold>web.config</legacyBold> file.
- </para>
- </listItem>
- <listItem>
- <para>
- Click <math>Clear Form</math> to clear text from the
- textboxes and the label that displays your chosen color.
- </para>
- </listItem>
- <listItem>
- <para>
- Now click <math>Retrieve Profile</math> to restore
- your profile data from the MySQL database.
- </para>
- </listItem>
- <listItem>
- <para>
- Now exit the browser to terminate the application.
- </para>
- </listItem>
- <listItem>
- <para>
- Run the application again. Note that when the page loads your
- profile information is restored from the MySQL database.
- </para>
- </listItem>
- </list>
- <para>
- In this tutorial you have seen how to using the MySQL Profile
- Provider with .
- </para>
+ <section address="connector-net-programming-tracing">
+ <title>Tracing</title>
+ <content>
+ <para>
+ 6.2 introduced support for .NET 2.0 compatible tracing,
+ using <literal>TraceSource</literal> objects.
+ </para>
+ <para>
+ The .NET 2.0 architecture consists of four main parts:
+ </para>
+ <list class="bullet">
+ <listItem>
+ <para>
+ <legacyBold>Source</legacyBold> - This is the originator of the
+ trace information. The source is used to send trace messages.
+ The name of the source provided by is
+ <literal>mysql</literal>.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ <legacyBold>Switch</legacyBold> - This defines the level of trace
+ information to emit. Typically, this is specified in the
+ <legacyBold>app.config</legacyBold> file, so that it is not
+ necessary to recompile an application in order to change the
+ trace level.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ <legacyBold>Listener</legacyBold> - Trace listeners define where
+ the trace information will be written to. Supported listeners
+ include, for example, the Visual Studio Output window, the
+ Windows Event Log, and the console.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ <legacyBold>Filter</legacyBold> - filters can be attached to
+ listeners. Filters determine the level of trace information
+ that will be written. While a switch defines the level of
+ information that will be written to all listeners, a filter
+ can be applied on a per-listener basis, giving finer grained
+ control of trace information.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ To use tracing a <literal>TraceSource</literal> object first needs
+ to be created. To create a <literal>TraceSource</literal> object
+ in you would use code similar to the following:
+ </para>
+ <codeInline>TraceSource ts = new TraceSource("mysql");</codeInline>
+ <para>
+ To enable trace messages you also need to configure a trace
+ switch. There are three main switch classes,
+ <literal>BooleanSwitch</literal>, <literal>SourceSwitch</literal>,
+ and <literal>TraceSwitch</literal>. Trace switches also have
+ associated with them a trace level enumeration, these are
+ <literal>Off</literal>, <literal>Error</literal>,
+ <literal>Warning</literal>, <literal>Info</literal>, and
+ <literal>Verbose</literal>. The following code snippet illustrates
+ creating a switch:
+ </para>
+ <code>
+ts.Switch = new SourceSwitch("MySwitch", "Verbose");
+</code>
+ <para>
+ This creates a <literal>SourceSwitch</literal>, called
+ <literal>MySwitch</literal>, and sets the trace level to
+ <literal>Verbose</literal>, meaning that all trace messages will
+ be written.
+ </para>
+ <para>
+ It is convenient to be able to change the trace level without
+ having to recompile the code. This is achieved by specifying the
+ trace level in application configuration file,
+ <legacyBold>app.config</legacyBold>. You then simply need to specify
+ the desired trace level in the configuration file and restart the
+ application. The trace source is configured within the
+ <literal>system.diagnostics</literal> section of the file. The
+ following XML snippet illustrates this:
+ </para>
+ <codeInline>
+ </codeInline>
+ <para>
+ By default trace information is written to the Output window of
+ Microsoft Visual Studio. However, there are a wide range of
+ listeners than can be attached to the trace source, so that trace
+ messages can be written out to various destinations. It is also
+ possible to create custom listeners to allow trace messages to be
+ written to other destinations as mobile devices and web services.
+ A commonly used example of a listener is
+ <literal>ConsoleTraceListener</literal>, which writes trace
+ messages to the console.
+ </para>
+ <para>
+ To add a listener at run time you can use code such as the
+ following:
+ </para>
+ <codeInline>ts.Listeners.Add(new ConsoleTraceListener());</codeInline>
+ <para>
+ You can then call methods on trace source object to generate trace
+ information. For example, the
+ <literal>TraceInformation()</literal>,
+ <literal>TraceEvent()</literal>, or <literal>TraceData()</literal>
+ methods can be used.
+ </para>
+ <para>
+ The <literal>TraceInformation()</literal> method simply prints a
+ string passed as a parameter. The <literal>TraceEvent()</literal>
+ method, as well as the optional informational string, requires a
+ <literal>TraceEventType</literal> value to be passed to indicate
+ the trace message type, and also an application specific ID. The
+ <literal>TraceEventType</literal> can have a value of
+ <literal>Verbose</literal>, <literal>Information</literal>,
+ <literal>Warning</literal>, <literal>Error</literal>, and
+ <literal>Critical</literal>. Using the
+ <literal>TraceData()</literal> method you can pass any object, for
+ example an exception object, instead of a message.
+ </para>
+ <para>
+ To ensure than these generated trace messages gets flushed from
+ the trace source buffers to listeners, you need to invoke the
+ <literal>Flush()</literal> method. When you are finished using a
+ trace source, you should call the <literal>Close()</literal>
+ method. The <literal>Close()</literal> method first calls
+ <literal>Flush()</literal>, to ensure any remaining data is
+ written out. It then frees up resources, and closes the listeners
+ associated with the trace source.
+ </para>
+ <code>ts.TraceInformation("Informational message");
+ts.TraceEvent(TraceEventType.Error, 3, "Optional error message");
+ts.TraceData(TraceEventType.Error, 3, ex); // pass exception object
+ts.Flush();
+...
+ts.Close();</code>
</content>
</section>
</developerConceptualDocument>
=== added file 'Documentation/Users Guide/connector-net-tutorials.aml'
--- a/Documentation/Users Guide/connector-net-tutorials.aml 1970-01-01 00:00:00 +0000
+++ b/Documentation/Users Guide/connector-net-tutorials.aml 2009-12-15 21:58:48 +0000
@@ -0,0 +1,2410 @@
+<topic id="34e3033f-b986-4073-95c8-945f73aa79b0" revisionNumber="1">
+ <developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <section address="connector-net-tutorials">
+ <title>Connector/NET Tutorials</title>
+ <content>
+ <autoOutline />
+ </content>
+ </section>
+ <section address="connector-net-tutorials-intro">
+ <title>Tutorial: An Introduction to Connector/NET Programming</title>
+ <content>
+ <autoOutline />
+ <para>
+ This section provides a gentle introduction to programming with
+ Connector/NET. The example code is written in C#, and is designed to
+ work on both Microsoft .NET Framework and Mono.
+ </para>
+ <para>
+ This tutorial is designed to get you up and running with
+ Connector/NET as quickly as possible, it does not go into detail on
+ any particular topic. However, the following sections of this manual
+ describe each of the topics introduced in this tutorial in more
+ detail. In this tutorial you are encouraged to type in and run the
+ code, modifying it as required for your setup.
+ </para>
+ <para>
+ This tutorial assumes you have MySQL and Connector/NET already
+ installed. It also assumes that you have installed the World example
+ database, which can be downloaded from the
+ <externalLink><linkText>MySQL Documentation
+ page</linkText><linkUri>http://dev.mysql.com/doc/</linkUri></externalLink>. You can also find details on how to install the
+ database on the same page.
+ </para>
+ <alert class="note">
+ <para>
+ Before compiling the example code make sure that you have added
+ References to your project as required. The References required
+ are <literal>System</literal>, <literal>System.Data</literal> and
+ <literal>MySql.Data</literal>.
+ </para>
+ </alert>
+ </content>
+ </section>
+ <section address="connector-net-tutorials-connection">
+ <title>The MySqlConnection Object</title>
+ <content>
+ <para>
+ For your Connector/NET application to connect to a MySQL database
+ it needs to establish a connection. This is achieved through the
+ use of a <literal>MySqlConnection</literal> object.
+ </para>
+ <para>
+ The MySqlConnection constructor takes a connection string as one
+ of its parameters. The connection string provides necessary
+ information to make the connection to the MySQL database. The
+ connection string is discussed more fully in
+ <link xlink:href="8b7d06e8-0177-4dd0-acca-f9c9caaa1072#connector-net-programming-connecting">Connecting to MySQL Using Connector/NET</link>. A
+ reference containing a list of supported connection string options
+ can also be found in
+ <link xlink:href="c26b6c1a-1652-4d9d-ac74-96cee9531a3b"></link>.
+ </para>
+ <para>
+ The following code shows how to create a connection object.
+ </para>
+ <code>using System;
+using System.Data;
+
+using MySql.Data;
+using MySql.Data.MySqlClient;
+
+public class Tutorial1
+{
+ public static void Main()
+ {
+ string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
+ MySqlConnection conn = new MySqlConnection(connStr);
+ try
+ {
+ Console.WriteLine("Connecting to MySQL...");
+ conn.Open();
+ // Perform databse operations
+ conn.Close();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.ToString());
+ }
+ Console.WriteLine("Done.");
+ }
+}</code>
+ <para>
+ When the <literal>MySqlConnection</literal> constructor is invoked
+ it returns a connection object, which is used for subsequent
+ database operations. The first operation in this example is to
+ open the connection. This needs to be done before further
+ operations take place. Before the application exits the connection
+ to the database needs to be closed by calling
+ <literal>Close</literal> on the connection object.
+ </para>
+ <para>
+ Sometimes an attempt to perform an <literal>Open</literal> on a
+ connection object can fail, this will generate an exception that
+ can be handled via standard exception handling code.
+ </para>
+ <para>
+ In this section you have learned how to create a connection to a
+ MySQL database, and open and close the corresponding connection
+ object.
+ </para>
+ </content>
+ </section>
+ <section address="connector-net-tutorials-sql-command">
+ <title>The MySqlCommand Object</title>
+ <content>
+ <para>
+ Once a connection has been established with the MySQL database,
+ the next step is do carry out the desired database operations.
+ This can be achieved through the use of the
+ <literal>MySqlCommand</literal> object.
+ </para>
+ <para>
+ You will see how to create a <literal>MySqlCommand</literal>
+ object. Once it has been created there are three main methods of
+ interest that you can call:
+ </para>
+ <list class="bullet">
+ <listItem>
+ <para>
+ <legacyBold>ExecuteReader</legacyBold> - used to query
+ the database. Results are usually returned in a
+ <literal>MySqlDataReader</literal> object, created by
+ <literal>ExecuteReader</literal>.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ <legacyBold>ExecuteNonQuery</legacyBold> - used to
+ insert and delete data.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ <legacyBold>ExecuteScalar</legacyBold> - used to
+ return a single value.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ Once a <literal>MySqlCommand</literal> object has been created,
+ you will call one of the above methods on it to carry out a
+ database operation, such as perform a query. The results are
+ usually returned into a <literal>MySqlDataReader</literal> object,
+ and then processed, for example the results might be displayed.
+ The following code demonstrates how this could be done.
+ </para>
+ <code>using System;
+using System.Data;
+
+using MySql.Data;
+using MySql.Data.MySqlClient;
+
+public class Tutorial2
+{
+ public static void Main()
+ {
+ string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
+ MySqlConnection conn = new MySqlConnection(connStr);
+ try
+ {
+ Console.WriteLine("Connecting to MySQL...");
+ conn.Open();
+
+ string sql = "SELECT Name, HeadOfState FROM Country WHERE Continent='Oceania'";
+ MySqlCommand cmd = new MySqlCommand(sql, conn);
+ MySqlDataReader rdr = cmd.ExecuteReader();
+
+ while (rdr.Read())
+ {
+ Console.WriteLine(rdr[0]+" -- "+rdr[1]);
+ }
+
+ rdr.Close();
+ conn.Close();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.ToString());
+ }
+ Console.WriteLine("Done.");
+ }
+}</code>
+ <para>
+ When a connection has been created and opened, the code then
+ creates a <literal>MySqlCommand</literal> object. Note that the
+ SQL query to be executed is passed to the
+ <literal>MySqlCommand</literal> constructor. The
+ <literal>ExecuteReader</literal> method is then used to generate a
+ <literal>MySqlReader</literal> object. The
+ <literal>MySqlReader</literal> object contains the results
+ generated by the SQL executed on the command object. Once the
+ results have been obtained in a <literal>MySqlReader</literal>
+ object, the results can be processed. In this case the information
+ is simply printed out as part of a <literal>while</literal> loop.
+ Finally, the <literal>MySqlReader</literal> object is displosed of
+ by running its <literal>Close</literal> method on it.
+ </para>
+ <para>
+ In the next example you will see how to use the
+ <literal>ExecuteNonQuery</literal> method.
+ </para>
+ <para>
+ The procedure for performing an <literal>ExecuteNonQuery</literal>
+ method call is simpler, as there is no need to create an object to
+ store results. This is because <literal>ExecuteNonQuery</literal>
+ is only used for inserting, updating and deleting data. The
+ following example illustrates a simple update to the Country
+ table:
+ </para>
+ <code>using System;
+using System.Data;
+
+using MySql.Data;
+using MySql.Data.MySqlClient;
+
+public class Tutorial3
+{
+ public static void Main()
+ {
+ string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
+ MySqlConnection conn = new MySqlConnection(connStr);
+ try
+ {
+ Console.WriteLine("Connecting to MySQL...");
+ conn.Open();
+
+ string sql = "INSERT INTO Country (Name, HeadOfState, Continent) VALUES ('Disneyland','Mickey Mouse', 'North America')";
+ MySqlCommand cmd = new MySqlCommand(sql, conn);
+ cmd.ExecuteNonQuery();
+
+ conn.Close();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.ToString());
+ }
+ Console.WriteLine("Done.");
+ }
+}</code>
+ <para>
+ The query is constructed, the command object created and the
+ <literal>ExecuteNonQuery</literal> method called on the command
+ object. You can access your MySQL database with the MySQL Client
+ program and verify that the update was carried out correctly.
+ </para>
+ <para>
+ Finally, you will see how the <literal>ExecuteScalar</literal>
+ method can be used to return a single value. Again, this is
+ straightforward, as a <literal>MySqlDataReader</literal> object is
+ not required to store results, a simple variable will do. The
+ following code illustrates how to use
+ <literal>ExecuteScalar</literal>:
+ </para>
+ <code>using System;
+using System.Data;
+
+using MySql.Data;
+using MySql.Data.MySqlClient;
+
+public class Tutorial4
+{
+ public static void Main()
+ {
+ string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
+ MySqlConnection conn = new MySqlConnection(connStr);
+ try
+ {
+ Console.WriteLine("Connecting to MySQL...");
+ conn.Open();
+
+ string sql = "SELECT COUNT(*) FROM Country";
+ MySqlCommand cmd = new MySqlCommand(sql, conn);
+ object result = cmd.ExecuteScalar();
+ if (result != null)
+ {
+ int r = Convert.ToInt32(result);
+ Console.WriteLine("Number of countries in the World database is: " + r);
+ }
+
+ conn.Close();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.ToString());
+ }
+ Console.WriteLine("Done.");
+ }
+}</code>
+ <para>
+ This example uses a simple query to count the rows in the Country
+ table. The result is obtained by calling
+ <literal>ExecuteScaler</literal> on the command object.
+ </para>
+ </content>
+ </section>
+ <section address="connector-net-tutorials-data-adapter">
+ <title>Working with Decoupled Data</title>
+ <content>
+ <para>
+ Previously, when using MySqlDataReader, the connection to the
+ database was continually maintained, unless explicitly closed. It
+ is also possible to work in a manner where a connection is only
+ established when needed. For example, in this mode, a connection
+ could be established in order to read a chunk of data, the data
+ could then be modified by the application as required. A
+ connection could then be reestablished only if and when the
+ application needs to write data back to the database. This
+ decouples the working data set from the database.
+ </para>
+ <para>
+ This decouple mode of working with data is supported by
+ Connector/NET. There are several parts involved in allowing this
+ method to work:
+ </para>
+ <list class="bullet">
+ <listItem>
+ <para>
+ <legacyBold>Data Set</legacyBold> - The Data Set is
+ the area in which data is loaded in order to read or modify
+ it. A <literal>DataSet</literal> object is instantiated, which
+ can store multiple tables of data.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ <legacyBold>Data Adapter</legacyBold> - The Data
+ Adapter is the interface between the Data Set and the database
+ itself. The Data Adapter is responsible for efficiently
+ managing connections to the database, opening and closing them
+ as required. The Data Adapter is created by instantiating an
+ object of the <literal>MySqlDataAdapter</literal> class. The
+ <literal>MySqlDataAdapter</literal> object has two main
+ methods: <literal>Fill</literal> which reads data into the
+ Data Set, and <literal>Update</literal>, which writes data
+ from the Data Set to the database.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ <legacyBold>Command Builder</legacyBold> - The Command
+ Builder is a support object. The Command Builder works in
+ conjunction with the Data Adapter. When a
+ <literal>MySqlDataAdapter</literal> object is created it is
+ typically given an initial SELECT statement. From this SELECT
+ statement the Command Builder can work out the corresponding
+ INSERT, UPDATE and DELETE statements that would be required
+ should the database need to be updated. To create the Command
+ Builder an object of the class
+ <literal>MySqlCommandBuilder</literal> is created.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ Each of these classes will now be discussed in more detail.
+ </para>
+ <para>
+ <legacyBold>Instantiating a DataSet object</legacyBold>
+ </para>
+ <para>
+ A <literal>DataSet</literal> object can be created simply, as
+ shown in the following example code snippet:
+ </para>
+ <code>DataSet dsCountry;
+...
+dsCountry = new DataSet();</code>
+ <para>
+ Although this creates the <literal>DataSet</literal> object it has
+ not yet filled it with data. For that a Data Adapter is required.
+ </para>
+ <para>
+ <legacyBold>Instantiating a MySqlDataAdapter
+ object</legacyBold>
+ </para>
+ <para>
+ The <literal>MySqlDataAdapter</literal> can be created as
+ illustrated by the following example:
+ </para>
+ <code>MySqlDataAdapter daCountry;
+...
+string sql = "SELECT Code, Name, HeadOfState FROM Country WHERE Continent='North America'";
+daCountry = new MySqlDataAdapter (sql, conn);</code>
+ <para>
+ Note, the <literal>MySqlDataAdapter</literal> is given the SQL
+ specifying the data you wish to work with.
+ </para>
+ <para>
+ <legacyBold>Instantiating a MySqlCommandBuilder
+ object</legacyBold>
+ </para>
+ <para>
+ Once the <literal>MySqlDataAdapter</literal> has been created, it
+ is necessary to generate the additional statements required for
+ inserting, updating and deleting data. There are several ways to
+ do this, but in this tutorial you will see how this can most
+ easily be done with <literal>MySqlCommandBuilder</literal>. The
+ following code snippet ilustrates how this is done:
+ </para>
+ <codeInline>MySqlCommandBuilder cb = new MySqlCommandBuilder(daCountry);</codeInline>
+ <para>
+ Note that the <literal>MySqlDataAdapter</literal> object is passed
+ as a parameter to the command builder.
+ </para>
+ <para>
+ <legacyBold>Filling the Data Set</legacyBold>
+ </para>
+ <para>
+ In order to do anything useful with the data from your datbase,
+ you need to load it into a Data Set. This is one of the jobs of
+ the <literal>MySqlDataAdapter</literal> object, and is carried out
+ with its <literal>Fill</literal> method. The following example
+ code illustrates this:
+ </para>
+ <code>
+DataSet dsCountry;
+...
+dsCountry = new DataSet();
+...
+daCountry.Fill(dsCountry, "Country");</code>
+ <para>
+ Note the <literal>Fill</literal> method is a
+ <literal>MySqlDataAdapter</literal> method, the Data Adapter knows
+ how to establish a connec tion with the database and retrieve the
+ required data, and then populates the Data Set when the
+ <literal>Fill</literal> method is called. The second parameter
+ is the table in the Data Set to update.
+ </para>
+ <para>
+ <legacyBold>Updating the Data Set</legacyBold>
+ </para>
+ <para>
+ The data in the Data Set can now be manipulated by the application
+ as required. At some point, changes to data will need to be
+ written back to the database. This is achieved through a
+ <literal>MySqlDataAdapter</literal> method, the
+ <literal>Update</literal> method.
+ </para>
+ <code>
+daCountry.Update(dsCountry, "Country");
+</code>
+ <para>
+ Again, the Data Set and the table within the Data Set to update
+ are specified.
+ </para>
+ <para>
+ <legacyBold>Working Example</legacyBold>
+ </para>
+ <para>
+ The interactions between the <literal>DataSet</literal>,
+ <literal>MySqlDataAdapter</literal> and
+ <literal>MySqlCommandBuilder</literal> classes can be a little
+ confusing, so their operation can perhaps be best illustrated by
+ working code.
+ </para>
+ <para>
+ In this example, data from the World database is read into a Data
+ Grid View control. Here, the data can be viewed and changed before
+ clicking an update button. The update button then activates code
+ to write changes back to the database. The code uses the
+ principles explained above. The application was built using the
+ Microsoft Visual Studio in order to place and create the user
+ interface controls, but the main code that uses the key classes
+ descibed above is shown below, and is portable.
+ </para>
+ <code>
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+using MySql.Data;
+using MySql.Data.MySqlClient;
+
+namespace WindowsFormsApplication5
+{
+ public partial class Form1 : Form
+ {
+ MySqlDataAdapter daCountry;
+ DataSet dsCountry;
+
+ public Form1()
+ {
+ InitializeComponent();
+ }
+
+ private void Form1_Load(object sender, EventArgs e)
+ {
+
+ string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
+ MySqlConnection conn = new MySqlConnection(connStr);
+ try
+ {
+ label2.Text = "Connecting to MySQL...";
+
+ string sql = "SELECT Code, Name, HeadOfState FROM Country WHERE Continent='North America'";
+ daCountry = new MySqlDataAdapter (sql, conn);
+ MySqlCommandBuilder cb = new MySqlCommandBuilder(daCountry);
+
+ dsCountry = new DataSet();
+ daCountry.Fill(dsCountry, "Country");
+ dataGridView1.DataSource = dsCountry;
+ dataGridView1.DataMember = "Country";
+ }
+ catch (Exception ex)
+ {
+ label2.Text = ex.ToString();
+ }
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ daCountry.Update(dsCountry, "Country");
+ label2.Text = "MySQL Database Updated!";
+ }
+
+ }
+}</code>
+ <para>
+ The application running is shown below:
+ </para>
+ <mediaLink>
+ <para />
+ <caption>World Database Application</caption>
+ <image xlink:href="connector-net-tutorials-1" />
+ </mediaLink>
+ <para />
+ </content>
+ </section>
+ <section address="connector-net-tutorials-parameters">
+ <title>Working with Parameters</title>
+ <content>
+ <para>
+ This part of the tutorial shows you how to use parameters in your
+ Connector/NET application.
+ </para>
+ <para>
+ Although it is possible to build SQL query strings directly from
+ user input, this is not advisable as it does not prevent from
+ erroneous or malicious information being entered. It is safer to
+ use parameters as they will be processed as field data only. For
+ example, imagine the following query was contructed from user
+ input:
+ </para>
+ <codeInline>string sql = "SELECT Name, HeadOfState FROM Country WHERE Continent = "+user_continent;</codeInline>
+ <para>
+ If the string <literal>user_continent</literal> came from a Text
+ Box control, there would potentially be no control over the string
+ enetred by the user. The user could enter a string that generates
+ a run time error, or in the worst case actually harms the system.
+ When using parameters it is not possible to do this because a
+ parameter is only ever treated as a field parameter, rather than
+ an arbitrary piece of SQL code.
+ </para>
+ <para>
+ The same query written user a parameter for user input would be:
+ </para>
+ <codeInline>string sql = "SELECT Name, HeadOfState FROM Country WHERE Continent = @Continent";</codeInline>
+ <para>
+ Note that the parameter is preceded by an '@' symbol to indicate
+ it is to be treated as a parameter.
+ </para>
+ <para>
+ As well as marking the position of the parameter in the query
+ string, it is necessary to create a parameter object that can be
+ passed to the Command object. In Connector/NET the class
+ <literal>MySqlParameter</literal> is used for this purpose. The
+ use of <literal>MySqlParameter</literal> is best illustrated by a
+ small code snippet:
+ </para>
+ <code>MySqlParameter param = new MySqlParameter();
+param.ParameterName = "@Continent";
+param.Value = "North America";
+cmd.Parameters.Add(param);</code>
+ <para>
+ In this example the string "North America" is supplied as the
+ parameter value statically, but in a more practical example it
+ would come from a user input control. Once the parameter has its
+ name and value set it needs to be added to the Command object
+ using the <literal>Add</literal> method.
+ </para>
+ <para>
+ A further example illustrates this:
+ </para>
+ <code>
+using System;
+using System.Data;
+
+using MySql.Data;
+using MySql.Data.MySqlClient;
+
+public class Tutorial5
+{
+ public static void Main()
+ {
+ string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
+ MySqlConnection conn = new MySqlConnection(connStr);
+ try
+ {
+ Console.WriteLine("Connecting to MySQL...");
+ conn.Open();
+
+ string sql = "SELECT Name, HeadOfState FROM Country WHERE Continent=@Continent";
+ MySqlCommand cmd = new MySqlCommand(sql, conn);
+
+ Console.WriteLine("Enter a continent e.g. 'North America', 'Europe': ");
+ string user_input = Console.ReadLine();
+
+ MySqlParameter param = new MySqlParameter();
+ param.ParameterName = "@Continent";
+ param.Value = user_input;
+ cmd.Parameters.Add(param);
+
+ MySqlDataReader rdr = cmd.ExecuteReader();
+
+ while (rdr.Read())
+ {
+ Console.WriteLine(rdr["Name"]+" --- "+rdr["HeadOfState"]);
+ }
+
+ conn.Close();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.ToString());
+ }
+ Console.WriteLine("Done.");
+ }
+}</code>
+ <para>
+ In this part of the tutorial you have see how to use parameters to
+ make your code more secure.
+ </para>
+ </content>
+ </section>
+ <section address="connector-net-tutorials-stored-procedures">
+ <title>Working with Stored Procedures</title>
+ <content>
+ <para>
+ In this section you will see how to work with Stored Procedures.
+ This section assumes you have a basic understanding of what a
+ Stored Procedure is, and how to create one.
+ </para>
+ <para>
+ For the purposes of this tutorial, you will create a simple Stored
+ Procedure to see how it can be called from Connector/NET. In the
+ MySQL Client program, connect to the World database and enter the
+ following Stored Procedure:
+ </para>
+ <code>
+DELIMITER //
+CREATE PROCEDURE country_hos
+(IN con CHAR(20))
+BEGIN
+ SELECT Name, HeadOfState FROM Country
+ WHERE Continent = con;
+END //
+DELIMITER ;</code>
+ <para>
+ Test the Stored Procedure wors as expec ted by typing the
+ following into the MySQL Client program:
+ </para>
+ <codeInline>CALL country_hos('Europe');</codeInline>
+ <para>
+ Note that The Stored Routine takes a single parameter, which is
+ the continent you wish to restrict your search to.
+ </para>
+ <para>
+ Having confirmed that the Stored Procedure is present and correct
+ you can now move on to seeing how it can be accessed from
+ Connector/NET.
+ </para>
+ <para>
+ Calling a Stored Procedure from your Connector/NET application is
+ similar to techniques you have seen earlier in this tutorial. A
+ <literal>MySqlCommand</literal> object is created, but rather than
+ taking a SQL query as a parameter it takes the name of the Stored
+ Procedure to call. The <literal>MySqlCommand</literal> object also
+ needs to be set to the type of Stored Procedure. This is
+ illustrated by the following code snippet:
+ </para>
+ <code>
+string rtn = "country_hos";
+MySqlCommand cmd = new MySqlCommand(rtn, conn);
+cmd.CommandType = CommandType.StoredProcedure;</code>
+ <para>
+ In this case you also need to pass a parameter to the Stored
+ Procedure. This can be achieved using the techniques seen in the
+ previous section on parameters,
+ <link xlink:href="34e3033f-b986-4073-95c8-945f73aa79b0#connector-net-tutorials-parameters">Working with Parameters</link>. This is
+ shown in the following code snippet:
+ </para>
+ <code>
+MySqlParameter param = new MySqlParameter();
+param.ParameterName = "@con";
+param.Value = "Europe";
+cmd.Parameters.Add(param);</code>
+ <para>
+ The value of the parameter <literal>@con</literal> could more
+ realistically have come from a user input control, but for
+ simplicity it is set as a static string in this example.
+ </para>
+ <para>
+ At this point everything is set up and all that now needs to be
+ done is to call the routine. This can be achieved using techniques
+ also learned in earlier sections, but in this case the
+ <literal>ExecuteReader</literal> method of the
+ <literal>MySqlCommand</literal> object is used.
+ </para>
+ <para>
+ Complete working code for the Stored Procedure example is shown
+ below:
+ </para>
+ <code>
+using System;
+using System.Data;
+
+using MySql.Data;
+using MySql.Data.MySqlClient;
+
+public class Tutorial6
+{
+ public static void Main()
+ {
+ string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
+ MySqlConnection conn = new MySqlConnection(connStr);
+ try
+ {
+ Console.WriteLine("Connecting to MySQL...");
+ conn.Open();
+
+ string rtn = "country_hos";
+ MySqlCommand cmd = new MySqlCommand(rtn, conn);
+ cmd.CommandType = CommandType.StoredProcedure;
+ MySqlParameter param = new MySqlParameter();
+ param.ParameterName = "@con";
+ param.Value = "Europe";
+ cmd.Parameters.Add(param);
+
+ MySqlDataReader rdr = cmd.ExecuteReader();
+ while (rdr.Read())
+ {
+ Console.WriteLine(rdr[0] + " --- " + rdr[1]);
+ }
+ conn.Close();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.ToString());
+ }
+ Console.WriteLine("Done.");
+ }
+}</code>
+ <para>
+ In this section you have seen how to call a Stored Procedure from
+ Connector/NET. For the moment, this concludes our introductory
+ tutorial on programming with Connector/NET.
+ </para>
+ </content>
+ </section>
+ <section address="connector-net-tutorials-asp-roles">
+ <title>Tutorial: ASP.NET Membership and Role Provider</title>
+ <content>
+ <para>
+ Many web sites feature the facility for the user to create a user
+ account. They can then log into the web site and enjoy a
+ personalized experience. This requires that the developer creates
+ database tables to store user information, along with code to
+ gather and process this data. This represents a burden on the
+ developer, and there is the possibility for security issues to
+ creep into the developed code. However, ASP.NET 2.0 introduced the
+ Membership system. This system is designed around the concept of
+ Membership, Profile and Role Providers, which together provide all
+ of the functionality to implement a user system, that previously
+ would have to have been created by the developer from scratch.
+ </para>
+ <para>
+ Currently, provides Membership, Role, Profile and Session
+ State Providers.
+ </para>
+ <para>
+ This tutorial shows you how to set up your ASP.NET web application
+ to use the Membership and Role Providers. It assumes that
+ you have MySQL Server installed, along with and Microsoft
+ Visual Studio. This tutorial was tested with 6.0.4 and
+ Microsoft Visual Studio 2008 Professional Edition.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ Create a new database in the MySQL Server using the MySQL
+ Command Line Client program (<literal>mysql</literal>), or
+ other suitable tool. It does not matter what name is used for
+ the database, but it should be noted down so that it can be
+ specified in the connection string constructed later in this
+ tutorial. This database will contain the tables, automatically
+ created for you later, used to store data about users and
+ roles.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Create a new ASP.NET Web Site in Visual Studio. If you are not
+ sure how to do this, refer to the following tutorial:
+ <link xlink:href="34e3033f-b986-4073-95c8-945f73aa79b0#connector-net-tutorials-entity-framework-databinding-linq-entities">Tutorial: Databinding in ASP.NET using LINQ on Entities</link>,
+ which demonstrates how to create a simple ASP.NET web site.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Add References to <literal>MySql.Data</literal> and
+ <literal>MySql.Web</literal> to the web site project.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Locate the <legacyBold>machine.config</legacyBold> file on your
+ system, which is the configuration file for the .NET
+ Framework.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Search the <legacyBold>machine.config</legacyBold> file to find
+ the membership provider
+ <literal>MySQLMembershipProvider</literal>.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Add the attribute
+ <literal>autogenerateschema="true"</literal>. The appropriate
+ section should now resemble the following (note: for the sake
+ of brevity some information has been excluded):
+ </para>
+ <code><membership>
+ <providers>
+ <add name="AspNetSqlMembershipProvider"
+ type="System.Web.Security.SqlMembershipProvider"
+ ...
+ connectionStringName="LocalSqlServer"
+ ... />
+ <add name="MySQLMembershipProvider"
+ autogenerateschema="true"
+ type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.0.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
+ connectionStringName="LocalMySqlServer"
+ ... />
+ </providers>
+</membership></code>
+ <para>
+ Note that the name for the connection string to be used to
+ connect to the server that contains the membership database is
+ <literal>LocalMySqlServer</literal>.
+ </para>
+ <para>
+ The <literal>autogenerateschema="true"</literal> attribute
+ will cause to silently create, or upgrade, the schema
+ on the database server, to contain the required tables for
+ storing membership information.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ It is now necessary to create the connection string referenced
+ in the previous step. Load the web site's
+ <legacyBold>web.config</legacyBold> file into Visual Studio.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Locate the section marked
+ <literal><connectionStrings></literal>. Add the
+ following connection string information:
+ </para>
+ <code><connectionStrings>
+ <remove name="LocalMySqlServer"/>
+ <add name="LocalMySqlServer"
+ connectionString="Datasource=localhost;Database=users;uid=root;pwd=password;"
+ providerName="MySql.Data.MySqlClient"/>
+</connectionStrings></code>
+ <para>
+ The database specified is the one created in the first step.
+ You could alternatively have used an existing database.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ At this point build the solution to ensure no errors are
+ present. This can be done by selecting
+ <ui>Build</ui>, <ui>Build Solution</ui>
+ from the main menu, or pressing .
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ ASP.NET supports the concept of locally and remotely
+ authenticated users. With local authentication the user is
+ validated using their Windows credentials when they attempt to
+ access the web site. This can be useful in an Intranet
+ environment. With remote authentication a user is prompted for
+ their login details when accessing the web site, and these
+ credentials are checked aganst the membership information
+ stored in a database server such as MySQL Server. You will now
+ see how to choose this form of authentication.
+ </para>
+ <para>
+ Start the ASP.NET Web Site Administration Tool. This can be
+ done quickly by clicking the small hammer/Earth icon in the
+ Solution Explorer. You can also launch this tool by selecting
+ <ui>Website</ui>, <ui>ASP.NET
+ Configuration</ui> from the main menu.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ In the ASP.NET Web Site Administration Tool click the
+ tab.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Now click the
+ link.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Select the radio
+ button. The web site will now need to provide a form to allow
+ the user to enter their login details. These will be checked
+ against membership information stored in the MySQL database.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Authentication Type</caption>
+ <image xlink:href="connector-net-tutorials-authentication-type" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ You now need to specify the Role and Membership Provider to be
+ used. Click the tab.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Click the link.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Now select the
+ and the radio buttons.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Select Membership and Role Provider</caption>
+ <image xlink:href="connector-net-tutorials-select-provider" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ In Visual Studio rebuild the solution by selecting
+ <ui>Build</ui>, <ui>Rebuild Solution</ui>
+ from the main menu.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Check that the necessary schema has been created. This can be
+ achieved using the MySQL Command Line Client program.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Membership and Role Provider Tables</caption>
+ <image xlink:href="connector-net-tutorials-tables" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ Assuming all is present and correct you can now create users
+ and roles for your web application. The easiest way to do this
+ is with the ASP.NET Web Site Administration Tool. However,
+ many web applications contain their own modules for creating
+ roles and users. For simplicity the ASP.NET Web Site
+ Administration Tool will be used in this tutorial.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ In the ASP.NET Web Site Administration Tool click on the
+ tab. Now that both the
+ Membership and Role Provider are enabled you will see links
+ for creating roles and users. Click the link.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Security Tab</caption>
+ <image xlink:href="connector-net-tutorials-security-tab" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ You can now enter the name of a new Role and click
+ <math>Add Role</math> to create the new Role. Create
+ new Roles as required.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Click the <math>Back</math> button.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Click the link. You can now
+ fill in information about the user to be created, and also
+ allocate that user to one or more Roles.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Create User</caption>
+ <image xlink:href="connector-net-tutorials-create-user" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ Using the MySQL Command Line Client program you can check that
+ your database has been correctly populated with the Membership
+ and Role data.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Membership and Roles Table Contents</caption>
+ <image xlink:href="connector-net-tutorials-users-roles-tables" />
+ </mediaLink>
+ <para />
+ </listItem>
+ </list>
+ <para>
+ In this tutorial you have seen how to set up the Membership
+ and Role Providers for use in your ASP.NET web application.
+ </para>
+ </content>
+ </section>
+ <section address="connector-net-tutorials-asp-provider-session-state">
+ <title>Tutorial: ASP.NET Session State Provider</title>
+ <content>
+ <para>
+ from version 6.1 has included a MySQL Session State
+ Provider. This provider allows you to store session state in a
+ MySQL database. The following tutorial shows you how to prepare to
+ use the MySQL Session State Provider, and then store session data
+ into the MySQL database. This tutorial uses Microsoft Visual
+ Studio 2008 Professional Edition, 6.1.1 and MySQL Server
+ 5.1. This tutorial also assumes you have created an empty
+ database, for example <literal>test</literal>, where you will
+ store session data. You could do this using the MySQL Command Line
+ Client tool.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ In Visual Studio create a new ASP.NET web site. If you are not
+ sure how to do this refer to the tutorial
+ <link xlink:href="34e3033f-b986-4073-95c8-945f73aa79b0#connector-net-tutorials-entity-framework-databinding-linq-entities">Tutorial: Databinding in ASP.NET using LINQ on Entities</link>
+ which demonstrates how to do this.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Launch the MySQL MySQL Website Configuration tool. Due to a
+ bug in 6.1.1 this may not appear unless you are connected to a
+ server in the Server Explorer. If you are unfamiliar with the
+ MySQL Website Configuration tool it is suggested that you
+ first work through the following tutorial
+ <link xlink:href="9f3f194e-ad35-4379-b04d-5dce4b34ce6a#connector-net-website-config">MySQL Website Configuration Tool</link>.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Navigate through the wizard to the Session State page. Make
+ sure the checkbox is seected.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ On the same page configure the connection string to the
+ database that will contain your session data. This database
+ can be empty as will create the schema required to
+ store session data.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Ensure that the checkbox is selected so that will create the
+ schema in your database to store the session data correctly.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Enter the name of your application.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Click <math>Finish</math>. The MySQL Website
+ Configuration tool will now update your application's
+ <legacyBold>web.config</legacyBold> file with information about
+ the connection string and default providers to be used. In
+ this case we have selected the MySQL Session State Provider.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ At this point you are ready to use the MySQL database to store
+ session data. To test that the set up has worked you can write a
+ simple program that uses session variables.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ Open <legacyBold>Default.aspx.cs</legacyBold>. In the Page_Load
+ method add the following code:
+ </para>
+ <codeInline>Session["SessionVariable1"] = "Test string";</codeInline>
+ </listItem>
+ <listItem>
+ <para>
+ Build your solution.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Run the solution (without debugging). When the application
+ runs, the provider will autogenerate tables required in the
+ database you chose when setting up the application.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Check that the schema was in fact created. Using the MySQL
+ Command Line Client use the target database and then type
+ <literal>SHOW TABLES;</literal>. You will see that has
+ created the required schema automatically, as we selected this
+ to happen in the MySQL Website Configuration tool.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Now view the contents of these tables by typing
+ <literal>SELECT * FROM my_aspnet_sessions;</literal> in the
+ MySQL Command Line Client. This will display the session data
+ our application used. Note that this is stored in binary
+ format so some data may not display as expected.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ At this point you have installed the Session State Provider and
+ carried out a preliminary test of the installation. You will now
+ work a bit more with the Session State Provider.
+ </para>
+ <para>
+ In this part of the tutorial you will set and retrieve a session
+ variable. You can work with your existing project.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ Select the <legacyBold>Default.aspx</legacyBold> and switch to
+ Design View. Add a text box and three buttons. Change the text
+ property for the buttons to , , and
+ . These will be
+ <literal>Button1</literal>, <literal>Button2</literal> and
+ <literal>Button3</literal> respectively. Build your solution
+ to ensure that no errors have been introduced.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Still in the Design View, double click
+ <literal>Button1</literal>. Now to the
+ <literal>Button1_Click</literal> event handler add code some
+ the handler resembles the following:
+ </para>
+ <code>
+protected void Button1_Click(object sender, EventArgs e)
+{
+ Session["SessionString"] = TextBox1.Text;
+}
+</code>
+ <para>
+ You have created a new Session variable accessed using the key
+ . This will be set to the text
+ that was entered into the text box when
+ <literal>Button1</literal> is clicked.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ In Design View double click <literal>Button2</literal> to add
+ its click event handler. This button needs to clear text from
+ the text box. The code to do this is as follows:
+ </para>
+ <code>
+protected void Button2_Click(object sender, EventArgs e)
+{
+ TextBox1.Text = "";
+}
+</code>
+ <para>
+ The code simply assigns an empty string to the
+ <literal>Text</literal> property of the text box.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ In the Desin View double click <literal>Button3</literal> and
+ modify the click handler as follows:
+ </para>
+ <code>
+protected void Button3_Click(object sender, EventArgs e)
+{
+ TextBox1.Text = (String)Session["SessionString"];
+}
+</code>
+ <para>
+ This will retrieve the session string and display it in the
+ text box.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Now modify the <literal>Page_Load</literal> method as follows:
+ </para>
+ <code>
+protected void Page_Load(object sender, EventArgs e)
+{
+ if (!IsPostBack)
+ {
+ TextBox1.Text = "Enter some text";
+ }
+}
+</code>
+ <para>
+ This ensures that when the page loads the text box
+ <literal>Text</literal> property is reset.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Ensure that the solution is saved and then rebuild the
+ solution.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Run the solution without debugging.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ The form will be displayed. Enter some text into the text box.
+ Now click <math>Store Session Variable</math>. At
+ this point you have stored the string in a session variable.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Now click <math>Clear Text</math> to clear the text
+ box.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Now click <math>Show Session Variable</math> to
+ retrieve and display the session variable.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Refresh the page to destroy the form and display a new form.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Click <math>Show Session Variable</math> the text
+ box will display the stored session variable, demonstrating
+ that the refreshing the page does not destroy the session
+ variable.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ This illustrates that the session state data is not destroyed when
+ a page is reloaded.
+ </para>
+ </content>
+ </section>
+ <section address="connector-net-tutorials-asp-provider-profile">
+ <title>Tutorial: ASP.NET Profile Provider</title>
+ <content>
+ <para>
+ This tutorial shows you how to use the MySQL Profile Provider to
+ store user profile information in a MySQL database. The tutorial
+ uses 6.1.1, MySQL Server 5.1 and Microsoft Visual Studio
+ 2008 Professional Edition.
+ </para>
+ <para>
+ Many modern web sites allow the user to create a personal profile.
+ This requires a significant amount of code, but ASP.NET reduces
+ this considerable by including the functionality in its Profile
+ classes. The Profile Provider provides an abstraction between
+ these classes and a data source. The MySQL Profile Provider allows
+ profile data to be stored in a MySQL database. This allows the
+ profile properties to be written to a persistent store, and be
+ retrieved when required. The Profile Provider also allows profile
+ data to be managed effectively, for example it allows profiles
+ that have not been accessed since a specific date to be deleted.
+ </para>
+ <para>
+ The following steps show you how you can select the MySQL Profile
+ Provider.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ Create a new ASP.NET web project.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Select the MySQL Website Configuration tool. Due to a bug in
+ 6.1.1 you may have to first connect to a server in Server
+ Explorer before the tool's icon will display in the toolbar of
+ the Solution Explorer.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ In the MySQL Website Configuration tool navigate through the
+ tool to the Profiles page.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Select the checkbox.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Select the checkbox.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Click the <math>Edit...</math> button and configure
+ a connection string for the database that will be used to
+ store user profile information.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Navigate to the last page of the tool and click
+ <math>Finish</math> to save your changes and exit
+ the tool.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ At this point you are now ready to start using the MySQL Profile
+ Provider. With the following steps you can carry out a preliminary
+ test of your installation.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ Open your <legacyBold>web.config</legacyBold> file.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Add a simple profile such as the following:
+ </para>
+ <code>
+<system.web>
+ <anonymousIdentification enabled="true"/>
+ <profile defaultProvider="MySQLProfileProvider">
+ ...
+ <properties>
+ <add name="Name" allowAnonymous="true"/>
+ <add name="Age" allowAnonymous="true" type="System.UInt16"/>
+ <group name="UI">
+ <add name="Color" allowAnonymous="true" defaultValue="Blue"/>
+ <add name="Style" allowAnonymous="true" defaultValue="Plain"/>
+ </group>
+ </properties>
+ </profile>
+ ...
+</code>
+ <para>
+ Note that <literal>anonymousIdentification</literal> has been
+ set to true. This allows users who have not been authenticated
+ to use profiles. They are identified by a GUID in a cookie
+ rather than by user name.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ Now that the simple profile has been defined in
+ <legacyBold>web.config</legacyBold>, the next step is to write some
+ code to test the profile.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ In Design View design a simple page with the following
+ controls:
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Simple Profile Application</caption>
+ <image xlink:href="connector-net-tutorials-asp-provider-profile-simple-app" />
+ </mediaLink>
+ <para />
+ <para>
+ These will allow the user to enter some profile information.
+ The user can also use the buttons to save their profile, clear
+ the page, and restore their profile data.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ In the Code View add code as follows:
+ </para>
+ <code>
+...
+protected void Page_Load(object sender, EventArgs e)
+{
+ if (!IsPostBack)
+ {
+ TextBox1.Text = Profile.Name;
+ TextBox2.Text = Profile.Age.ToString();
+ Label1.Text = Profile.UI.Color;
+ }
+}
+
+// Store Profile
+protected void Button1_Click(object sender, EventArgs e)
+{
+ Profile.Name = TextBox1.Text;
+ Profile.Age = UInt16.Parse(TextBox2.Text);
+}
+
+// Clear Form
+protected void Button2_Click(object sender, EventArgs e)
+{
+ TextBox1.Text = "";
+ TextBox2.Text = "";
+ Label1.Text = "";
+}
+
+// Retrieve Profile
+protected void Button3_Click(object sender, EventArgs e)
+{
+ TextBox1.Text = Profile.Name;
+ TextBox2.Text = Profile.Age.ToString();
+ Label1.Text = Profile.UI.Color;
+}
+
+protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
+{
+ Profile.UI.Color = DropDownList1.SelectedValue;
+}
+...
+</code>
+ </listItem>
+ <listItem>
+ <para>
+ Save all files and build the solution to check that no errors
+ have been introduced.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Run the application.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Enter your name, age and select a color from the listbox. Now
+ store this information in your profile by clicking
+ <math>Store Profile</math>. Note that if you do not
+ select a color from the listbox your profile will use the
+ default color <literal>Blue</literal> that was specified in
+ the <legacyBold>web.config</legacyBold> file.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Click <math>Clear Form</math> to clear text from the
+ textboxes and the label that displays your chosen color.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Now click <math>Retrieve Profile</math> to restore
+ your profile data from the MySQL database.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Now exit the browser to terminate the application.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Run the application again. Note that when the page loads your
+ profile information is restored from the MySQL database.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ In this tutorial you have seen how to using the MySQL Profile
+ Provider with .
+ </para>
+ </content>
+ </section>
+ <section address="connector-net-tutorials-entity-framework-winform-data-source">
+ <title>Tutorial: Using an Entity Framework Entity as a Windows Forms Data
+ Source</title>
+ <content>
+ <para>
+ In this tutorial you will learn how to create a Windows Forms Data
+ Source from an Entity in an Entity Data Model. This tutorial
+ assumes that you have installed the World example database, which
+ can be downloaded from the
+ <externalLink><linkText>MySQL Documentation
+ page</linkText><linkUri>http://dev.mysql.com/doc/</linkUri></externalLink>. You can also find details on how to install the
+ database on the same page. It will also be convenient for you to
+ create a connection to the World database after it is installed.
+ For instructions on how to do this see
+ <link xlink:href="9f3f194e-ad35-4379-b04d-5dce4b34ce6a#connector-net-visual-studio-making-a-connection">Making a connection</link>.
+ </para>
+ <para>
+ <legacyBold>Creating a new Windows Forms
+ application</legacyBold>
+ </para>
+ <para>
+ The first step is to create a new Windows Forms application.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ In Visual Studio, select <ui>File</ui>,
+ <ui>New</ui>, <ui>Project</ui> from the
+ main menu.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Choose the
+ installed template. Click <math>OK</math>. The
+ solution is created.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ <legacyBold>Adding an Entity Data Model</legacyBold>
+ </para>
+ <para>
+ You will now add an Entity Data Model to your solution.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ In the Solution Explorer, right click on your application and
+ select <ui>Add</ui>, <ui>New Item...</ui>.
+ From
+ select . Click
+ <math>Add</math>.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Add Entity Data Model</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-add-entity-data-model" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ You will now see the Entity Data Model Wizard. You will use
+ the wizard to generate the Entity Data Model from the world
+ example database. Select the icon . Click <math>Next</math>.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Entity Data Model Wizard Screen 1</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-entity-data-model-wizard-1" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ You can now select the connection you made earlier to the
+ World database. If you have not already done so, you can
+ create the new connection at this time by clicking on
+ <math>New Connection...</math>. For further
+ instructions on creating a connection to a database see
+ <link xlink:href="9f3f194e-ad35-4379-b04d-5dce4b34ce6a#connector-net-visual-studio-making-a-connection">Making a connection</link>.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Entity Data Model Wizard Screen 2</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-entity-data-model-wizard-2" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ Make a note of the entity connection settings to be used in
+ App.Config, as these will be used later to write the necessary
+ control code.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Click <math>Next</math>.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ The Entity Data Model Wizard connects to the database. You are
+ then presented with a tree structure of the database. From
+ this you can select the object you would like to include in
+ your model. If you had created Views and Stored Routines these
+ will be displayed along with any tables. In this example you
+ just need to select the tables. Click
+ <math>Finish</math> to create the model and exit the
+ wizard.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Entity Data Model Wizard Screen 3</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-entity-data-model-wizard-3" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ Visual Studio will generate the model and then display it.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Entity Data Model Diagram</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-entity-data-model-diagram" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ From the Visual Studio main menu select
+ <ui>Build</ui>, <ui>Build Solution</ui>,
+ to ensure that everything compiles correctly so far.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ <legacyBold>Adding a new Data Source</legacyBold>
+ </para>
+ <para>
+ You will now add a new Data Source to your project and see how it
+ can be used to read and write to the database.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ From the Visual Studio main menu select
+ <ui>Data</ui>, <ui>Add New Data
+ Source...</ui>. You will be presented with the Data
+ Source Configuration Wizard.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Entity Data Source Configuration Wizard Screen 1</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-data-source-configuration-wizard-1" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ Select the icon. Click
+ <math>Next</math>.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ You will now select the Object you wish to bind to. Expand the
+ tree. In this tutorial you will select the city table. Once
+ the city table has been selected click
+ <math>Next</math>.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Entity Data Source Configuration Wizard Screen 2</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-data-source-configuration-wizard-2" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ The wizard will confirm that the city object is to be added.
+ Click <math>Finish</math>.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Entity Data Source Configuration Wizard Screen 3</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-data-source-configuration-wizard-3" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ The city object will be display in the Data Sources panel. If
+ the Data Sources panel is not displayed, select
+ <ui>Data</ui>, <ui>Show Data Sources</ui>
+ from the Visual Studio main menu. The docked panel will then
+ be displayed.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Data Sources</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-data-sources" />
+ </mediaLink>
+ <para />
+ </listItem>
+ </list>
+ <para>
+ <legacyBold>Using the Data Source in a Windows
+ Form</legacyBold>
+ </para>
+ <para>
+ You will now learn how to use the Data Source in a Windows Form.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ In the Data Sources panel select the Data Source you just
+ created and drag and drop it onto the Form Designer. By
+ default the Data Source object will be added as a Data Grid
+ View control. Note that the Data Grid View control is bound to
+ the <literal>cityBindingSource</literal> and the Navigator
+ control is bound to <literal>cityBindingNavigator</literal>.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Data Form Designer</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-data-form-design" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ Save and rebuild the solution before continuing.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ <legacyBold>Adding Code to Populate the Data Grid
+ View</legacyBold>
+ </para>
+ <para>
+ You are now ready to add code to ensure that the Data Grid View
+ control will be populated with data from the City database table.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ Double click the form to access its code.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Add code to instatiate the Entity Data Model's EntityContainer
+ object and retrieve data from the database to populate the
+ control.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Adding Code to the Form</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-form-add-code" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ Save and rebuild the solution.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Run the solution. Ensure the grid is populated and you can
+ navigate the database.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>The Populated Grid Control</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-app-running-1" />
+ </mediaLink>
+ <para />
+ </listItem>
+ </list>
+ <para>
+ <legacyBold>Adding Code to Save Changes to the
+ Database</legacyBold>
+ </para>
+ <para>
+ You will now add code to enable you to save changes to the
+ database.
+ </para>
+ <para>
+ The Binding source component ensures that changes made in the Data
+ Grid View control are also made to the Entity classes bound to it.
+ However, that data needs to be saved back from the entities to the
+ database itself. This can be achieved by the enabling of the Save
+ button in the Navigator control, and the addition of some code.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ In the Form Designer click on the Save icon in the Form
+ toolbar and ensure that its Enabled property is set to True.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Save Button Enabled</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-save-enabled" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ Double click the Save icon in the Form toolbar to display its
+ code.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ You now need to add code to ensure that data is saved to the
+ database when the save button is click in the application.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Adding Save Code to the Form</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-form-add-code-save" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ Once the code has been added, save the solution and rebuild
+ it. Run the application and verify that changes made in the
+ grid are saved.
+ </para>
+ </listItem>
+ </list>
+ </content>
+ </section>
+ <section address="connector-net-tutorials-entity-framework-databinding-linq-entities">
+ <title>Tutorial: Databinding in ASP.NET using LINQ on Entities</title>
+ <content>
+ <para>
+ In this tutorial you create an ASP.NET web page that binds LINQ
+ queries to entities using the Entity Framework mapping.
+ </para>
+ <para>
+ If you have not already done so, you should install the World
+ example database prior to attempting this tutorial. Instructions
+ on where to obtain the database and instructions on how to install
+ it where given in the tutorial
+ <link xlink:href="34e3033f-b986-4073-95c8-945f73aa79b0#connector-net-tutorials-entity-framework-winform-data-source">Tutorial: Using an Entity Framework Entity as a Windows Forms Data
+ Source</link>.
+ </para>
+ <para>
+ <legacyBold>Creating an ASP.NET web site</legacyBold>
+ </para>
+ <para>
+ In this part of the tutorial you will create an ASP.NET web site.
+ The web site will use the World database. The main web page will
+ feature a drop down list from which you can select a country, data
+ about that country's cities will then be displayed in a grid view
+ control.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ From the Visual Studio main menu select
+ <ui>File</ui>, <ui>New</ui>, <ui>Web
+ Site...</ui>.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ From the Visual Studio installed templates select
+ . Click
+ <math>OK</math>. You will be presented with the
+ Source view of your web page by default.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Click the Design view tab situated underneath the Source view
+ panel.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>The Design Tab</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-tutorial-linq-1" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ In the Design view panel, enter some text to decorate the
+ blank web page.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Click on Toolbox. From the list of controls select
+ . Drag and drop the control
+ to a location beneath the text on your web page.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Drop Down List</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-tutorial-linq-2" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ From the control's context
+ menu, ensure that the
+ check box is enabled. This will ensure the control's event
+ handler is called when an item is selected. The user's choice
+ will in turn be used to populate the
+ control.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Enable AutoPostBack</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-tutorial-linq-3" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ From the Toolbox select the
+ control.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Grid View Control</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-tutorial-linq-4" />
+ </mediaLink>
+ <para />
+ <para>
+ Drag and drop the Grid Vew control to a location just below
+ the Drop Down List you already placed.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Placed Grid Vew Control</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-tutorial-linq-5" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ At this point it is recommended that you save your solution,
+ and build the solution to ensure that there are no errors.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ If you run the solution you will see that the text and drop
+ down list are displayed, but the list is empty. Also, the grid
+ view does not appear at all. Adding this functionality is
+ described in the following sections.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ At this stage you have a web site that will build, but further
+ functionality is required. The next step will be to use the Entity
+ Framework to create a mapping from the World database into
+ entities that you can control programmatically.
+ </para>
+ <para>
+ <legacyBold>Creating an ADO.NET Entity Data
+ Model</legacyBold>
+ </para>
+ <para>
+ In this stage of the tutorial you will add an ADO.NET Entity Data
+ Model to your project, using the World database at the storage
+ level. The procedure for doing this is described in the tutorial
+ <link xlink:href="34e3033f-b986-4073-95c8-945f73aa79b0#connector-net-tutorials-entity-framework-winform-data-source">Tutorial: Using an Entity Framework Entity as a Windows Forms Data
+ Source</link>,
+ and so will not be repeated here.
+ </para>
+ <para>
+ <legacyBold>Populating a Drop Data List Box with using
+ the results of a entity LINQ query</legacyBold>
+ </para>
+ <para>
+ In this part of the tutorial you will write code to populate the
+ DropDownList control. When the web page loads the data to populate
+ the list will be achieved by using the results of a LINQ query on
+ the model created previously.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ In the Design view panel, double click on any blank area. This
+ brings up the method.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Modify the relevant section of code according to the following
+ listing:
+ </para>
+ <code>
+...
+public partial class _Default : System.Web.UI.Page
+{
+ worldModel.worldEntities we;
+
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ we = new worldModel.worldEntities();
+
+ if (!IsPostBack)
+ {
+ var countryQuery = from c in we.country
+ orderby c.Name
+ select new { c.Code, c.Name };
+ DropDownList1.DataValueField = "Code";
+ DropDownList1.DataTextField = "Name";
+ DropDownList1.DataSource = countryQuery;
+ DataBind();
+ }
+ }
+...
+</code>
+ <para>
+ Note that the list control only needs to be populated when the
+ page first loads. The conditional code ensures that if the
+ page is subsequently reloaded, the list control is not
+ repopulated, which would cause the user selection to be lost.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Save the solution, build it and run it. You should see the
+ list control has been populated. You can select an item, but
+ as yet the grid view control does not apear.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ At this point you have a working Drop Down List control, populated
+ by a LINQ query on your entity data model.
+ </para>
+ <para>
+ <legacyBold>Populating a Grid View control using an
+ entity LINQ query</legacyBold>
+ </para>
+ <para>
+ In the last part of this tutorial you will populate the Grid View
+ Control using a LINQ query on your entity data model.
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ In the Design view double click on the
+ control. This causes its
+ code to be
+ displayed. This method is called when a user selects an item
+ in the list control and thus fires an AutoPostBack event.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Modify the relevant section of code accordingly to the
+ following listing:
+ </para>
+ <code>
+...
+ protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ var cityQuery = from c in we.city
+ where c.CountryCode == DropDownList1.SelectedValue
+ orderby c.Name
+ select new { c.Name, c.Population, c.CountryCode };
+ GridView1.DataSource = cityQuery;
+ DataBind();
+ }
+...
+</code>
+ <para>
+ The grid view control is populated from the result of the LINQ
+ query on the entity data model.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ As a check compare your code to that shown in the following
+ screenshot:
+ </para>
+ <mediaLink>
+ <para />
+ <caption>Source Code</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-tutorial-linq-6" />
+ </mediaLink>
+ <para />
+ </listItem>
+ <listItem>
+ <para>
+ Save, build and run the solution. As you select a country you
+ will see its cities are displayed in the grid view control.
+ </para>
+ <mediaLink>
+ <para />
+ <caption>The Working Web Site</caption>
+ <image xlink:href="connector-net-visual-studio-entity-framework-tutorial-linq-7" />
+ </mediaLink>
+ <para />
+ </listItem>
+ </list>
+ <para>
+ In this tutorial you have seen how to create an ASP.NET web site,
+ you have also seen how you can access a MySQL database via LINQ
+ queries on an entity data model.
+ </para>
+ </content>
+ </section>
+ <section address="connector-net-tutorials-ssl">
+ <title>Tutorial: Using SSL with </title>
+ <content>
+ <para>
+ In this tutorial you will learn how you can use to connect to
+ a MySQL server configured to use SSL. Support for SSL client
+ certificates was added with 6.2.
+ </para>
+ <para>
+ MySQL Server uses the PEM format for certificates and private keys.
+ This tutorial will use the test certificates from the server test
+ suite by way of example. You can obtain the MySQL Server source code
+ from
+ <externalLink><linkText>MySQL
+ Downloads</linkText><linkUri>http://dev.mysql.com/downloads/mysql/5.1.html#source</linkUri></externalLink>. The certificates can be found in the directory
+ <legacyBold>./mysql-test/std_data</legacyBold>.
+ </para>
+ <para>
+ To carry out the steps in this tutorial you will also need to have
+ Open SSL installed. This can be downloaded for Microsoft Windows at
+ no charge from
+ <externalLink><linkText>Shining
+ Light Productions</linkText><linkUri>http://www.slproweb.com/products/Win32OpenSSL.html</linkUri></externalLink>.
+ </para>
+ <para>
+ Further details on the connection string options used in this
+ tutorial can be found at
+ <link xlink:href="c26b6c1a-1652-4d9d-ac74-96cee9531a3b"></link>.
+ </para>
+ <para>
+ <legacyBold>Configuring the MySQL Server to use
+ SSL</legacyBold>
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ In the MySQL Server configuration file, set the SSL parameters
+ as follows:
+ </para>
+ <code>ssl-ca=path/to/repo/mysql-test/std_data/cacert.pem
+ssl-cert=path/to/repo/mysql-test/std_data/server-cert.pem
+ssl-key=path/to/repo/mysql-test/std_data/server-key.pem
+</code>
+ <para>
+ Adjust the directories according to the location in which you
+ installed the MySQL source code.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ In this step you create a test user and set the user to require
+ SSL.
+ </para>
+ <para>
+ Using the MySQL Command Line Client, connect as root and create
+ the user <literal>sslclient</literal>.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ To set privileges and requirements, issue the following command:
+ </para>
+ <codeInline>GRANT ALL PRIVILEGES ON *.* TO sslclient@'%' REQUIRE SSL;</codeInline>
+ </listItem>
+ </list>
+ <para>
+ <legacyBold> Creating a certificate file to use with the
+ .NET client</legacyBold>
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ The .NET client does not use the PEM file format, as .NET does
+ not support this format natively. You will be using test client
+ certificates from the same server repository, for the purposes
+ of this example. You will need to convert these to PFX format
+ first. This format is also known as PKCS#12. An article
+ describing this procedure can be found at the
+ <externalLink><linkText>Citrix
+ website</linkText><linkUri>http://support.citrix.com/article/CTX106630</linkUri></externalLink>. From the directory
+ <legacyBold>server-repository-root/mysql-test/std_data</legacyBold>,
+ issue the following command:
+ </para>
+ <codeInline>openssl pkcs12 -export -in client-cert.pem -inkey client-key.pem -certfile cacert.pem -out client.pfx</codeInline>
+ </listItem>
+ <listItem>
+ <para>
+ When asked for an export password, enter the password
+ . The file <legacyBold>client.pfx</legacyBold>
+ will be generated. This file is used in the remainder of the
+ tutorial.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ <legacyBold>Connecting to the server using a file-based
+ certificate</legacyBold>
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ You will use PFX file, <legacyBold>client.pfx</legacyBold> you
+ created in the previous step to authenticate the client. The
+ following example demonstrates how to connect using the
+ <literal>SSL Mode</literal>, <literal>CertificateFile</literal>
+ and <literal>CertificatePassword</literal> connection string
+ options:
+ </para>
+ <code>using (MySqlConnection connection = new MySqlConnection(
+ "database=test;user=sslclient;" +
+ "CertificateFile=H:\\bzr\\mysql-trunk\\mysqlest\\std_data\\client.pfx" +
+ "CertificatePassword=pass;" +
+ "SSL Mode=Required "))
+{
+ connection.Open();
+}</code>
+ <para>
+ The path to the certificate file will need to be changed to
+ reflect your individual installation.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ <legacyBold>Connecting to the server using a store-based
+ certificate</legacyBold>
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ The first step is to import the PFX file,
+ <legacyBold>client.pfx</legacyBold>, into the Personal Store.
+ Double-click the file in Windows explorer. This launches the
+ Certificate Import Wizard.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Follow the steps dictated by the wizard, and when prompted for
+ the password for the PFX file, enter .
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Click <math>Finish</math> to close the wizard and
+ import the certificate into the personal store.
+ </para>
+ </listItem>
+ </list>
+ <para>
+ <legacyBold>Examine certificates in the Personal
+ Store</legacyBold>
+ </para>
+ <list class="ordered">
+ <listItem>
+ <para>
+ Start the Microsoft Management Console by entering
+ <legacyBold>mmc.exe</legacyBold> at a command prompt.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Select <ui>File</ui>, <ui>Add/Remove
+ snap-in</ui>. Click <math>Add</math>. Select
+ from the list of available
+ snap-ins in the dialog.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Click <math>Add</math> button in the dialog, and
+ select the radio button.
+ This is used for personal certificates.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Click the <math>Finish</math> button.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Click <math>OK</math> to close the Add/Remove Snap-in
+ dialog.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ You will now have displayed in the left panel of the Microsoft
+ Management Console. Expand the Certificates - Current User tree
+ item and select ,
+ . The right-hand panel will
+ display a certificate issued to MySQL. This is the certificate
+ that was previously imported. Double-click the certificate to
+ display its details.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ After you have imported the certificate to the Personal Store,
+ you can use a more succint connection string to connect to the
+ database, as illustrated by the following code:
+ </para>
+ <code>using (MySqlConnection connection = new MySqlConnection(
+ "database=test;user=sslclient;" +
+ "Certificate Store Location=CurrentUser;" +
+ "SSL Mode=Required"))
+{
+ connection.Open();
+}</code>
+ </listItem>
+ </list>
+ <para>
+ <legacyBold>Certificate Thumbprint Parameter</legacyBold>
+ </para>
+ <para>
+ If you have a large number of certificates in your store, and many
+ have the same Issuer, this can be a source of confusion and result
+ in the wrong certificate being used. To alleviate this situation,
+ there is an optional Certificate Thumbprint parameter that can
+ additionally be specified as part of the connection string. As
+ mentioned before, you can double-click on a certificate in the
+ Microsoft Management Console to display the certificate's details.
+ When the Certificate dialog is displayed click the
+ tab and scroll down to see the
+ thumbprint. The thumbprint will typically be a number such as
+ <literal>‎47 94 36 00 9a 40 f3 01 7a 14 5c f8 47 9e 76 94 d7 aa de
+ f0</literal>. This thumbprint can be used in the connection string,
+ as the following code illustrates:
+ </para>
+ <code>using (MySqlConnection connection = new MySqlConnection(
+ "database=test;user=sslclient;" +
+ "Certificate Store Location=CurrentUser;" +
+ "Certificate Thumbprint=479436009a40f3017a145cf8479e7694d7aadef0;"+
+ "SSL Mode=Required"))
+{
+ connection.Open();
+}</code>
+ <para>
+ Spaces in the thumbprint parameter are optional and the value is
+ case-insensitive.
+ </para>
+ </content>
+ </section>
+ </developerConceptualDocument>
+</topic>
\ No newline at end of file
=== modified file 'Documentation/Users Guide/connector-net-versions.aml'
--- a/Documentation/Users Guide/connector-net-versions.aml 2009-09-08 17:12:22 +0000
+++ b/Documentation/Users Guide/connector-net-versions.aml 2009-12-15 21:58:48 +0000
@@ -9,9 +9,9 @@
<list class="bullet">
<listItem>
<para>
- Connector/NET 1.0 includes support for MySQL 4.0, MySQL 5.0
- features, and full compatibility with the ADO.NET driver
- interface.
+ Connector/NET 1.0 includes support for MySQL 4.0, MySQL 4.1,
+ MySQL 5.0 features, and full compatibility with the ADO.NET
+ driver interface.
</para>
</listItem>
<listItem>
@@ -25,9 +25,9 @@
</listItem>
<listItem>
<para>
- Connector/NET 5.1 includes support for MySQL 4.0, MySQL 5.0,
- MySQL 5.1 and MySQL 6.0 (Falcon Preview) features. Connector/NET
- 5.1 also includes support for a new membership/role provider,
+ Connector/NET 5.1 includes support for MySQL 4.0, MySQL 4.1,
+ MySQL 5.0, MySQL 5.1 and MySQL 5.4 features. Connector/NET 5.1
+ also includes support for a new membership/role provider,
Compact Framework 2.0, a new stored procedure parser and
improvements to <literal>GetSchema</literal>. Connector/NET 5.1
also includes the Visual Studio Plugin as a standard installable
@@ -36,8 +36,8 @@
</listItem>
<listItem>
<para>
- Connector/NET 5.2 includes support for MySQL 5.0, MySQL 5.1 and
- MySQL 6.0 (Falcon Preview) features. Connector/NET 5.2 also
+ Connector/NET 5.2 includes support for MySQL 4.1, MySQL 5.0,
+ MySQL 5.1 and MySQL 5.4 features. Connector/NET 5.2 also
includes support for a new membership/role provider, Compact
Framework 2.0, a new stored procedure parser and improvements to
<literal>GetSchema</literal>. Connector/NET 5.2 also includes
@@ -46,16 +46,29 @@
</listItem>
<listItem>
<para>
- Connector/NET 6.0 includes support for MySQL 5.0, MySQL 5.1 and
- MySQL 6.0.
- </para>
- </listItem>
- <listItem>
- <para>
- Connector/NET 6.1 includes support for MySQL 5.0, MySQL 5.1,
- MySQL 5.4 and MySQL 6.0. Important new features include the
- MySQL Website Configuration Tool and a Session State Provider.
- Connector/NET 6.1 is currently available as an Alpha release.
+ Connector/NET 6.0 includes support for MySQL 4.1, MySQL 5.0,
+ MySQL 5.1 and MySQL 5.4.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Connector/NET 6.1 includes support for MySQL 4.1, MySQL 5.0,
+ MySQL 5.1, MySQL 5.4. Important new features include the MySQL
+ Website Configuration Tool and a Session State Provider.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Connector/NET 6.2 includes support for MySQL 4.1, MySQL 5.0,
+ MySQL 5.1, MySQL 5.4. Important new features include a new
+ logging system and client SSL certificates. Connector/NET 6.2 is
+ currently available as a Beta release.
+ </para>
+ </listItem>
+ <listItem>
+ <para>
+ Connector/NET 6.3 includes support for MySQL 5.0, MySQL 5.1,
+ MySQL 5.4. Connector/NET 6.3 is not yet available.
</para>
</listItem>
</list>
@@ -102,7 +115,7 @@
<para>1.x</para>
</entry>
<entry>
- <para>4.0, 5.0</para>
+ <para>4.0, 4.1, 5.0</para>
</entry>
</row>
<row>
@@ -110,13 +123,13 @@
<para>5.0</para>
</entry>
<entry>
- <para>1.x+</para>
- </entry>
- <entry>
- <para>2.x+</para>
- </entry>
- <entry>
- <para>4.0, 5.0</para>
+ <para>2.x+</para>
+ </entry>
+ <entry>
+ <para>2.x+</para>
+ </entry>
+ <entry>
+ <para>4.0, 4.1, 5.0</para>
</entry>
</row>
<row>
@@ -124,13 +137,13 @@
<para>5.1</para>
</entry>
<entry>
- <para>1.x+</para>
- </entry>
- <entry>
- <para>2.x+</para>
- </entry>
- <entry>
- <para>4.0, 5.0, 5.1, 6.0</para>
+ <para>2.x+</para>
+ </entry>
+ <entry>
+ <para>2.x+</para>
+ </entry>
+ <entry>
+ <para>4.0, 4.1, 5.0, 5.1, 5.4</para>
</entry>
</row>
<row>
@@ -138,13 +151,13 @@
<para>5.2</para>
</entry>
<entry>
- <para>1.x+</para>
- </entry>
- <entry>
- <para>2.x+</para>
- </entry>
- <entry>
- <para>5.0, 5.1, 6.0</para>
+ <para>2.x+</para>
+ </entry>
+ <entry>
+ <para>2.x+</para>
+ </entry>
+ <entry>
+ <para>4.1, 5.0, 5.1, 5.4</para>
</entry>
</row>
<row>
@@ -158,7 +171,7 @@
<para>2.x+</para>
</entry>
<entry>
- <para>5.0, 5.1, 6.0</para>
+ <para>4.1, 5.0, 5.1, 5.4</para>
</entry>
</row>
<row>
@@ -172,15 +185,44 @@
<para>2.x+</para>
</entry>
<entry>
- <para>5.0, 5.1, 5.4, 6.0</para>
+ <para>4.1, 5.0, 5.1, 5.4</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>6.2</para>
+ </entry>
+ <entry>
+ <para>2.x+</para>
+ </entry>
+ <entry>
+ <para>2.x+</para>
+ </entry>
+ <entry>
+ <para>4.1, 5.0, 5.1, 5.4</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>6.3</para>
+ </entry>
+ <entry>
+ <para>2.x+</para>
+ </entry>
+ <entry>
+ <para>2.x+</para>
+ </entry>
+ <entry>
+ <para>5.0, 5.1, 5.4</para>
</entry>
</row>
</table>
<alert class="note">
<para>
- Version numbers for MySQL products are formatted as X.X.X.
+ Version numbers for MySQL products are formatted as X.Y.Z, where
+ Z=0 indicates alpha, Z=1 indicates beta, and Z>=2 indicates GA.
However, Windows tools (Control Panel, properties display) may
- show the version numbers as XX.XX.XX. For example, the official
+ show the version numbers as XX.YY.ZZ. For example, the official
MySQL formatted version number 5.0.9 may be displayed by Windows
tools as 5.00.09. The two versions are the same; only the number
display format is different.
=== modified file 'Documentation/Users Guide/connector-net-visual-studio.aml'
--- a/Documentation/Users Guide/connector-net-visual-studio.aml 2009-09-08 17:12:22 +0000
+++ b/Documentation/Users Guide/connector-net-visual-studio.aml 2009-12-15 21:58:48 +0000
@@ -1,7 +1,7 @@
<topic id="9f3f194e-ad35-4379-b04d-5dce4b34ce6a" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<section address="connector-net-visual-studio">
- <title> Visual Studio Integration</title>
+ <title>Connector/NET Visual Studio Integration</title>
<content>
<autoOutline />
</content>
@@ -850,7 +850,6 @@
<section address="connector-net-visual-studio-entity-framework">
<title>Using the ADO.NET Entity Framework</title>
<content>
- <autoOutline />
<para>
Connector/NET 6.0 introduced support for the ADO.NET Entity
Framework. ADO.NET Entity Framework was included with .NET
@@ -897,630 +896,14 @@
<externalLink><linkText>Microsoft
ADO.NET Entity Framework documentation</linkText><linkUri>http://msdn.microsoft.com/en-us/library/aa697427(VS.80).aspx</linkUri></externalLink>.
</para>
- </content>
- </section>
- <section address="connector-net-visual-studio-entity-framework-tutorial-winform-data-source">
- <title>Tutorial: Using an Entity Framework Entity as a Windows Forms Data
- Source</title>
- <content>
- <para>
- In this tutorial you will learn how to create a Windows Forms
- Data Source from an Entity in an Entity Data Model. This
- tutorial assumes that you have installed the World example
- database, which can be downloaded from the
- <externalLink><linkText>MySQL Documentation
- page</linkText><linkUri>http://dev.mysql.com/doc/</linkUri></externalLink>. You can also find details on how to install the
- database on the same page. It will also be convenient for you to
- create a connection to the World database after it is installed.
- For instructions on how to do this see
- <link xlink:href="9f3f194e-ad35-4379-b04d-5dce4b34ce6a#connector-net-visual-studio-making-a-connection">Making a connection</link>.
- </para>
- <para>
- <legacyBold>Creating a new Windows Forms
- application</legacyBold>
- </para>
- <para>
- The first step is to create a new Windows Forms application.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- In Visual Studio, select <ui>File</ui>,
- <ui>New</ui>, <ui>Project</ui> from the
- main menu.
- </para>
- </listItem>
- <listItem>
- <para>
- Choose the
- installed template. Click <math>OK</math>. The
- solution is created.
- </para>
- </listItem>
- </list>
- <para>
- <legacyBold>Adding an Entity Data Model</legacyBold>
- </para>
- <para>
- You will now add an Entity Data Model to your solution.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- In the Solution Explorer, right click on your application
- and select <ui>Add</ui>, <ui>New
- Item...</ui>. From select . Click <math>Add</math>.
- </para>
- <mediaLink>
- <para />
- <caption>Add Entity Data Model</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-add-entity-data-model" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- You will now see the Entity Data Model Wizard. You will use
- the wizard to generate the Entity Data Model from the world
- example database. Select the icon . Click <math>Next</math>.
- </para>
- <mediaLink>
- <para />
- <caption>Entity Data Model Wizard Screen 1</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-entity-data-model-wizard-1" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- You can now select the connection you made earlier to the
- World database. If you have not already done so, you can
- create the new connection at this time by clicking on
- <math>New Connection...</math>. For further
- instructions on creating a connection to a database see
- <link xlink:href="9f3f194e-ad35-4379-b04d-5dce4b34ce6a#connector-net-visual-studio-making-a-connection">Making a connection</link>.
- </para>
- <mediaLink>
- <para />
- <caption>Entity Data Model Wizard Screen 2</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-entity-data-model-wizard-2" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- Make a note of the entity connection settings to be used in
- App.Config, as these will be used later to write the
- necessary control code.
- </para>
- </listItem>
- <listItem>
- <para>
- Click <math>Next</math>.
- </para>
- </listItem>
- <listItem>
- <para>
- The Entity Data Model Wizard connects to the database. You
- are then presented with a tree structure of the database.
- From this you can select the object you would like to
- include in your model. If you had created Views and Stored
- Routines these will be displayed along with any tables. In
- this example you just need to select the tables. Click
- <math>Finish</math> to create the model and exit
- the wizard.
- </para>
- <mediaLink>
- <para />
- <caption>Entity Data Model Wizard Screen 3</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-entity-data-model-wizard-3" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- Visual Studio will generate the model and then display it.
- </para>
- <mediaLink>
- <para />
- <caption>Entity Data Model Diagram</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-entity-data-model-diagram" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- From the Visual Studio main menu select
- <ui>Build</ui>, <ui>Build Solution</ui>,
- to ensure that everything compiles correctly so far.
- </para>
- </listItem>
- </list>
- <para>
- <legacyBold>Adding a new Data Source</legacyBold>
- </para>
- <para>
- You will now add a new Data Source to your project and see how
- it can be used to read and write to the database.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- From the Visual Studio main menu select
- <ui>Data</ui>, <ui>Add New Data
- Source...</ui>. You will be presented with the Data
- Source Configuration Wizard.
- </para>
- <mediaLink>
- <para />
- <caption>Entity Data Source Configuration Wizard Screen 1</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-data-source-configuration-wizard-1" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- Select the icon. Click
- <math>Next</math>.
- </para>
- </listItem>
- <listItem>
- <para>
- You will now select the Object you wish to bind to. Expand
- the tree. In this tutorial you will select the city table.
- Once the city table has been selected click
- <math>Next</math>.
- </para>
- <mediaLink>
- <para />
- <caption>Entity Data Source Configuration Wizard Screen 2</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-data-source-configuration-wizard-2" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- The wizard will confirm that the city object is to be added.
- Click <math>Finish</math>.
- </para>
- <mediaLink>
- <para />
- <caption>Entity Data Source Configuration Wizard Screen 3</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-data-source-configuration-wizard-3" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- The city object will be display in the Data Sources panel.
- If the Data Sources panel is not displayed, select
- <ui>Data</ui>, <ui>Show Data
- Sources</ui> from the Visual Studio main menu. The
- docked panel will then be displayed.
- </para>
- <mediaLink>
- <para />
- <caption>Data Sources</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-data-sources" />
- </mediaLink>
- <para />
- </listItem>
- </list>
- <para>
- <legacyBold>Using the Data Source in a Windows
- Form</legacyBold>
- </para>
- <para>
- You will now learn how to use the Data Source in a Windows Form.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- In the Data Sources panel select the Data Source you just
- created and drag and drop it onto the Form Designer. By
- default the Data Source object will be added as a Data Grid
- View control. Note that the Data Grid View control is bound
- to the <literal>cityBindingSource</literal> and the
- Navigator control is bound to
- <literal>cityBindingNavigator</literal>.
- </para>
- <mediaLink>
- <para />
- <caption>Data Form Designer</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-data-form-design" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- Save and rebuild the solution before continuing.
- </para>
- </listItem>
- </list>
- <para>
- <legacyBold>Adding Code to Populate the Data Grid
- View</legacyBold>
- </para>
- <para>
- You are now ready to add code to ensure that the Data Grid View
- control will be populated with data from the City database
- table.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- Double click the form to access its code.
- </para>
- </listItem>
- <listItem>
- <para>
- Add code to instatiate the Entity Data Model's
- EntityContainer object and retrieve data from the database
- to populate the control.
- </para>
- <mediaLink>
- <para />
- <caption>Adding Code to the Form</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-form-add-code" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- Save and rebuild the solution.
- </para>
- </listItem>
- <listItem>
- <para>
- Run the solution. Ensure the grid is populated and you can
- navigate the database.
- </para>
- <mediaLink>
- <para />
- <caption>The Populated Grid Control</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-app-running-1" />
- </mediaLink>
- <para />
- </listItem>
- </list>
- <para>
- <legacyBold>Adding Code to Save Changes to the
- Database</legacyBold>
- </para>
- <para>
- You will now add code to enable you to save changes to the
- database.
- </para>
- <para>
- The Binding source component ensures that changes made in the
- Data Grid View control are also made to the Entity classes bound
- to it. However, that data needs to be saved back from the
- entities to the database itself. This can be achieved by the
- enabling of the Save button in the Navigator control, and the
- addition of some code.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- In the Form Designer click on the Save icon in the Form
- toolbar and ensure that its Enabled property is set to True.
- </para>
- <mediaLink>
- <para />
- <caption>Save Button Enabled</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-save-enabled" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- Double click the Save icon in the Form toolbar to display
- its code.
- </para>
- </listItem>
- <listItem>
- <para>
- You now need to add code to ensure that data is saved to the
- database when the save button is click in the application.
- </para>
- <mediaLink>
- <para />
- <caption>Adding Save Code to the Form</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-form-add-code-save" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- Once the code has been added, save the solution and rebuild
- it. Run the application and verify that changes made in the
- grid are saved.
- </para>
- </listItem>
- </list>
- </content>
- </section>
- <section address="connector-net-visual-studio-entity-framework-tutorial-databinding-linq-entities">
- <title>Tutorial: Databinding in ASP.NET using LINQ on Entities</title>
- <content>
- <para>
- In this tutorial you create an ASP.NET web page that binds LINQ
- queries to entities using the Entity Framework mapping.
- </para>
- <para>
- If you have not already done so, you should install the World
- example database prior to attempting this tutorial. Instructions
- on where to obtain the database and instructions on how to
- install it where given in the tutorial
- <link xlink:href="9f3f194e-ad35-4379-b04d-5dce4b34ce6a#connector-net-visual-studio-entity-framework-tutorial-winform-data-source">Tutorial: Using an Entity Framework Entity as a Windows Forms Data
- Source</link>.
- </para>
- <para>
- <legacyBold>Creating an ASP.NET web site</legacyBold>
- </para>
- <para>
- In this part of the tutorial you will create an ASP.NET web
- site. The web site will use the World database. The main web
- page will feature a drop down list from which you can select a
- country, data about that country's cities will then be displayed
- in a grid view control.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- From the Visual Studio main menu select
- <ui>File</ui>, <ui>New</ui>,
- <ui>Web Site...</ui>.
- </para>
- </listItem>
- <listItem>
- <para>
- From the Visual Studio installed templates select
- . Click
- <math>OK</math>. You will be presented with the
- Source view of your web page by default.
- </para>
- </listItem>
- <listItem>
- <para>
- Click the Design view tab situated underneath the Source
- view panel.
- </para>
- <mediaLink>
- <para />
- <caption>The Design Tab</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-tutorial-linq-1" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- In the Design view panel, enter some text to decorate the
- blank web page.
- </para>
- </listItem>
- <listItem>
- <para>
- Click on Toolbox. From the list of controls select
- . Drag and drop the control
- to a location beneath the text on your web page.
- </para>
- <mediaLink>
- <para />
- <caption>Drop Down List</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-tutorial-linq-2" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- From the control's context
- menu, ensure that the check box is enabled. This will
- ensure the control's event handler is called when an item is
- selected. The user's choice will in turn be used to populate
- the control.
- </para>
- <mediaLink>
- <para />
- <caption>Enable AutoPostBack</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-tutorial-linq-3" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- From the Toolbox select the
- control.
- </para>
- <mediaLink>
- <para />
- <caption>Grid View Control</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-tutorial-linq-4" />
- </mediaLink>
- <para />
- <para>
- Drag and drop the Grid Vew control to a location just below
- the Drop Down List you already placed.
- </para>
- <mediaLink>
- <para />
- <caption>Placed Grid Vew Control</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-tutorial-linq-5" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- At this point it is recommended that you save your solution,
- and build the solution to ensure that there are no errors.
- </para>
- </listItem>
- <listItem>
- <para>
- If you run the solution you will see that the text and drop
- down list are displayed, but the list is empty. Also, the
- grid view does not appear at all. Adding this functionality
- is described in the following sections.
- </para>
- </listItem>
- </list>
- <para>
- At this stage you have a web site that will build, but further
- functionality is required. The next step will be to use the
- Entity Framework to create a mapping from the World database
- into entities that you can control programmatically.
- </para>
- <para>
- <legacyBold>Creating an ADO.NET Entity Data
- Model</legacyBold>
- </para>
- <para>
- In this stage of the tutorial you will add an ADO.NET Entity
- Data Model to your project, using the World database at the
- storage level. The procedure for doing this is described in the
- tutorial
- <link xlink:href="9f3f194e-ad35-4379-b04d-5dce4b34ce6a#connector-net-visual-studio-entity-framework-tutorial-winform-data-source">Tutorial: Using an Entity Framework Entity as a Windows Forms Data
- Source</link>,
- and so will not be repeated here.
- </para>
- <para>
- <legacyBold>Populating a Drop Data List Box with using
- the results of a entity LINQ query</legacyBold>
- </para>
- <para>
- In this part of the tutorial you will write code to populate the
- DropDownList control. When the web page loads the data to
- populate the list will be achieved by using the results of a
- LINQ query on the model created previously.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- In the Design view panel, double click on any blank area.
- This brings up the
- method.
- </para>
- </listItem>
- <listItem>
- <para>
- Modify the relevant section of code according to the
- following listing:
- </para>
- <code>
-...
-public partial class _Default : System.Web.UI.Page
-{
- worldModel.worldEntities we;
-
- protected void Page_Load(object sender, EventArgs e)
- {
- we = new worldModel.worldEntities();
-
- if (!IsPostBack)
- {
- var countryQuery = from c in we.country
- orderby c.Name
- select new { c.Code, c.Name };
- DropDownList1.DataValueField = "Code";
- DropDownList1.DataTextField = "Name";
- DropDownList1.DataSource = countryQuery;
- DataBind();
- }
- }
-...
-</code>
- <para>
- Note that the list control only needs to be populated when
- the page first loads. The conditional code ensures that if
- the page is subsequently reloaded, the list control is not
- repopulated, which would cause the user selection to be
- lost.
- </para>
- </listItem>
- <listItem>
- <para>
- Save the solution, build it and run it. You should see the
- list control has been populated. You can select an item, but
- as yet the grid view control does not apear.
- </para>
- </listItem>
- </list>
- <para>
- At this point you have a working Drop Down List control,
- populated by a LINQ query on your entity data model.
- </para>
- <para>
- <legacyBold>Populating a Grid View control using an
- entity LINQ query</legacyBold>
- </para>
- <para>
- In the last part of this tutorial you will populate the Grid
- View Control using a LINQ query on your entity data model.
- </para>
- <list class="ordered">
- <listItem>
- <para>
- In the Design view double click on the
- control. This causes its
- code to be
- displayed. This method is called when a user selects an item
- in the list control and thus fires an AutoPostBack event.
- </para>
- </listItem>
- <listItem>
- <para>
- Modify the relevant section of code accordingly to the
- following listing:
- </para>
- <code>
-...
- protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
- {
- var cityQuery = from c in we.city
- where c.CountryCode == DropDownList1.SelectedValue
- orderby c.Name
- select new { c.Name, c.Population, c.CountryCode };
- GridView1.DataSource = cityQuery;
- DataBind();
- }
-...
-</code>
- <para>
- The grid view control is populated from the result of the
- LINQ query on the entity data model.
- </para>
- </listItem>
- <listItem>
- <para>
- As a check compare your code to that shown in the following
- screenshot:
- </para>
- <mediaLink>
- <para />
- <caption>Source Code</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-tutorial-linq-6" />
- </mediaLink>
- <para />
- </listItem>
- <listItem>
- <para>
- Save, build and run the solution. As you select a country
- you will see its cities are displayed in the grid view
- control.
- </para>
- <mediaLink>
- <para />
- <caption>The Working Web Site</caption>
- <image xlink:href="connector-net-visual-studio-entity-framework-tutorial-linq-7" />
- </mediaLink>
- <para />
- </listItem>
- </list>
- <para>
- In this tutorial you have seen how to create an ASP.NET web
- site, you have also seen how you can access a MySQL database via
- LINQ queries on an entity data model.
- </para>
+ <para>
+ Tutorials on getting started with ADO.NET Entity Framework are
+ available. See
+ <link xlink:href="34e3033f-b986-4073-95c8-945f73aa79b0#connector-net-tutorials-entity-framework-winform-data-source">Tutorial: Using an Entity Framework Entity as a Windows Forms Data
+ Source</link>
+ and
+ <link xlink:href="34e3033f-b986-4073-95c8-945f73aa79b0#connector-net-tutorials-entity-framework-databinding-linq-entities">Tutorial: Databinding in ASP.NET using LINQ on Entities</link>.
+ </para>
</content>
</section>
<section address="connector-net-website-config">
@@ -1656,8 +1039,6 @@
<image xlink:href="connector-net-website-config-tool-tables" />
</mediaLink>
<para />
- <para>
- </para>
</content>
</section>
</developerConceptualDocument>
=== added file 'Documentation/Users Guide/media/connector-net-tutorials-1.png'
Binary files a/Documentation/Users Guide/media/connector-net-tutorials-1.png 1970-01-01 00:00:00 +0000 and b/Documentation/Users Guide/media/connector-net-tutorials-1.png 2009-12-15 21:58:48 +0000 differ
=== added file 'Documentation/Users Guide/media/connector-net-tutorials-asp-provider-profile-simple-app.png'
Binary files a/Documentation/Users Guide/media/connector-net-tutorials-asp-provider-profile-simple-app.png 1970-01-01 00:00:00 +0000 and b/Documentation/Users Guide/media/connector-net-tutorials-asp-provider-profile-simple-app.png 2009-12-15 21:58:48 +0000 differ
=== added file 'Documentation/Users Guide/media/connector-net-tutorials-authentication-type.png'
Binary files a/Documentation/Users Guide/media/connector-net-tutorials-authentication-type.png 1970-01-01 00:00:00 +0000 and b/Documentation/Users Guide/media/connector-net-tutorials-authentication-type.png 2009-12-15 21:58:48 +0000 differ
=== added file 'Documentation/Users Guide/media/connector-net-tutorials-create-user.png'
Binary files a/Documentation/Users Guide/media/connector-net-tutorials-create-user.png 1970-01-01 00:00:00 +0000 and b/Documentation/Users Guide/media/connector-net-tutorials-create-user.png 2009-12-15 21:58:48 +0000 differ
=== added file 'Documentation/Users Guide/media/connector-net-tutorials-security-tab.png'
Binary files a/Documentation/Users Guide/media/connector-net-tutorials-security-tab.png 1970-01-01 00:00:00 +0000 and b/Documentation/Users Guide/media/connector-net-tutorials-security-tab.png 2009-12-15 21:58:48 +0000 differ
=== added file 'Documentation/Users Guide/media/connector-net-tutorials-select-provider.png'
Binary files a/Documentation/Users Guide/media/connector-net-tutorials-select-provider.png 1970-01-01 00:00:00 +0000 and b/Documentation/Users Guide/media/connector-net-tutorials-select-provider.png 2009-12-15 21:58:48 +0000 differ
=== added file 'Documentation/Users Guide/media/connector-net-tutorials-tables.png'
Binary files a/Documentation/Users Guide/media/connector-net-tutorials-tables.png 1970-01-01 00:00:00 +0000 and b/Documentation/Users Guide/media/connector-net-tutorials-tables.png 2009-12-15 21:58:48 +0000 differ
=== added file 'Documentation/Users Guide/media/connector-net-tutorials-users-roles-tables.png'
Binary files a/Documentation/Users Guide/media/connector-net-tutorials-users-roles-tables.png 1970-01-01 00:00:00 +0000 and b/Documentation/Users Guide/media/connector-net-tutorials-users-roles-tables.png 2009-12-15 21:58:48 +0000 differ
=== modified file 'Documentation/config.txt'
--- a/Documentation/config.txt 2009-09-08 17:05:09 +0000
+++ b/Documentation/config.txt 2009-12-15 21:58:48 +0000
@@ -6,7 +6,7 @@
<Mapping name="connector-net-install" guid="733e518a-a16a-4bc2-b767-831875f277b6"/>
<Mapping name="connector-net-programming" guid="8b7d06e8-0177-4dd0-acca-f9c9caaa1072"/>
<Mapping name="connector-net-programming-connection-options" guid="c26b6c1a-1652-4d9d-ac74-96cee9531a3b"/>
- <Mapping name="connector-net-programming-tutorial" guid="34e3033f-b986-4073-95c8-945f73aa79b0"/>
+ <Mapping name="connector-net-tutorials" guid="34e3033f-b986-4073-95c8-945f73aa79b0"/>
<Mapping name="connector-net-support" guid="67810605-cf21-4439-a4bd-86ee11af8f16"/>
<Mapping name="connector-net-versions" guid="069908d6-c522-49cc-a854-32494f1de72b"/>
</TopicMap>
=== modified file 'Documentation/help.shfbproj'
--- a/Documentation/help.shfbproj 2009-09-08 17:08:39 +0000
+++ b/Documentation/help.shfbproj 2009-12-15 21:58:48 +0000
@@ -28,8 +28,8 @@
</ProjectSummary>
<MissingTags>None</MissingTags>
<VisibleItems>InheritedMembers, InheritedFrameworkMembers, Protected, SealedProtected</VisibleItems>
- <HtmlHelp1xCompilerPath>C:\Program Files (x86)\HTML Help Workshop\</HtmlHelp1xCompilerPath>
- <HtmlHelp2xCompilerPath>C:\Program Files (x86)\Common Files\microsoft shared\Help 2.0 Compiler\</HtmlHelp2xCompilerPath>
+ <HtmlHelp1xCompilerPath>..\..\..\Program Files\HTML Help Workshop\</HtmlHelp1xCompilerPath>
+ <HtmlHelp2xCompilerPath>..\..\..\Program Files\Common Files\microsoft shared\Help 2.0 Compiler\</HtmlHelp2xCompilerPath>
<SandcastlePath>
</SandcastlePath>
<WorkingPath>
@@ -49,9 +49,10 @@
<NamingMethod>MemberName</NamingMethod>
<DocumentationSources>
<DocumentationSource sourceFile="..\MySql.Data\Provider\bin\Release\MySql.Data.dll" />
-<DocumentationSource sourceFile="..\MySql.Data\Provider\bin\Release\MySql.Data.xml" />
-<DocumentationSource sourceFile="..\MySql.Web\Providers\bin\release\MySql.Web.dll" />
-<DocumentationSource sourceFile="..\MySql.Web\Providers\bin\release\webdocs.xml" /></DocumentationSources>
+ <DocumentationSource sourceFile="..\MySql.Data\Provider\bin\Release\MySql.Data.xml" />
+ <DocumentationSource sourceFile="..\MySql.Web\Providers\bin\release\MySql.Web.dll" />
+ <DocumentationSource sourceFile="..\MySql.Web\Providers\bin\release\webdocs.xml" />
+ </DocumentationSources>
<NamespaceSummaries>
<NamespaceSummaryItem name="(global)" isDocumented="False" xmlns="" />
<NamespaceSummaryItem name="MySql.Data.Common" isDocumented="False" xmlns="" />
@@ -74,9 +75,9 @@
<Folder Include="Users Guide\" />
</ItemGroup>
<ItemGroup>
+ <None Include="Users Guide\connector-net-tutorials.aml" />
<None Include="Users Guide\connector-net-versions.aml" />
<None Include="Users Guide\connector-net-support.aml" />
- <None Include="Users Guide\connector-net-programming-tutorial.aml" />
<None Include="Users Guide\connector-net-programming-connection-options.aml" />
<None Include="Users Guide\connector-net-programming.aml" />
<None Include="Users Guide\connector-net-install.aml" />
=== modified file 'Documentation/images.proj'
--- a/Documentation/images.proj 2009-09-08 17:12:22 +0000
+++ b/Documentation/images.proj 2009-12-15 21:58:48 +0000
@@ -51,6 +51,54 @@
<Image Include="Users Guide\media\connector-net-visual-studio-stored-procedure-saved.png">
<ImageId>connector-net-visual-studio-stored-procedure-saved</ImageId>
</Image>
+ <Image Include="Users Guide\media\connector-net-website-config-tool.png">
+ <ImageId>connector-net-website-config-tool</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-website-config-tool-membership.png">
+ <ImageId>connector-net-website-config-tool-membership</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-website-config-tool-string-editor.png">
+ <ImageId>connector-net-website-config-tool-string-editor</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-website-config-tool-options.png">
+ <ImageId>connector-net-website-config-tool-options</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-website-config-tool-roles.png">
+ <ImageId>connector-net-website-config-tool-roles</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-website-config-tool-profiles.png">
+ <ImageId>connector-net-website-config-tool-profiles</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-website-config-tool-session-state.png">
+ <ImageId>connector-net-website-config-tool-session-state</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-website-config-tool-tables.png">
+ <ImageId>connector-net-website-config-tool-tables</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-tutorials-1.png">
+ <ImageId>connector-net-tutorials-1</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-tutorials-authentication-type.png">
+ <ImageId>connector-net-tutorials-authentication-type</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-tutorials-select-provider.png">
+ <ImageId>connector-net-tutorials-select-provider</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-tutorials-tables.png">
+ <ImageId>connector-net-tutorials-tables</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-tutorials-security-tab.png">
+ <ImageId>connector-net-tutorials-security-tab</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-tutorials-create-user.png">
+ <ImageId>connector-net-tutorials-create-user</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-tutorials-users-roles-tables.png">
+ <ImageId>connector-net-tutorials-users-roles-tables</ImageId>
+ </Image>
+ <Image Include="Users Guide\media\connector-net-tutorials-asp-provider-profile-simple-app.png">
+ <ImageId>connector-net-tutorials-asp-provider-profile-simple-app</ImageId>
+ </Image>
<Image Include="Users Guide\media\connector-net-visual-studio-entity-framework-add-entity-data-model.png">
<ImageId>connector-net-visual-studio-entity-framework-add-entity-data-model</ImageId>
</Image>
@@ -114,53 +162,5 @@
<Image Include="Users Guide\media\connector-net-visual-studio-entity-framework-tutorial-linq-7.png">
<ImageId>connector-net-visual-studio-entity-framework-tutorial-linq-7</ImageId>
</Image>
- <Image Include="Users Guide\media\connector-net-website-config-tool.png">
- <ImageId>connector-net-website-config-tool</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-website-config-tool-membership.png">
- <ImageId>connector-net-website-config-tool-membership</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-website-config-tool-string-editor.png">
- <ImageId>connector-net-website-config-tool-string-editor</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-website-config-tool-options.png">
- <ImageId>connector-net-website-config-tool-options</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-website-config-tool-roles.png">
- <ImageId>connector-net-website-config-tool-roles</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-website-config-tool-profiles.png">
- <ImageId>connector-net-website-config-tool-profiles</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-website-config-tool-session-state.png">
- <ImageId>connector-net-website-config-tool-session-state</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-website-config-tool-tables.png">
- <ImageId>connector-net-website-config-tool-tables</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-programming-tutorial-authentication-type.png">
- <ImageId>connector-net-programming-tutorial-authentication-type</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-programming-tutorial-select-provider.png">
- <ImageId>connector-net-programming-tutorial-select-provider</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-programming-tutorial-tables.png">
- <ImageId>connector-net-programming-tutorial-tables</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-programming-tutorial-security-tab.png">
- <ImageId>connector-net-programming-tutorial-security-tab</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-programming-tutorial-create-user.png">
- <ImageId>connector-net-programming-tutorial-create-user</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-programming-tutorial-users-roles-tables.png">
- <ImageId>connector-net-programming-tutorial-users-roles-tables</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-programming-tutorial-asp-provider-profile-simple-app.png">
- <ImageId>connector-net-programming-tutorial-asp-provider-profile-simple-app</ImageId>
- </Image>
- <Image Include="Users Guide\media\connector-net-programming-tutorial-1.png">
- <ImageId>connector-net-programming-tutorial-1</ImageId>
- </Image>
</ItemGroup>
</Project>
\ No newline at end of file
Attachment: [text/bzr-bundle] bzr/reggie.burnett@sun.com-20091215215848-p315l7w3dkr7t5l9.bundle
| Thread |
|---|
| • bzr commit into connector-net-trunk branch (reggie.burnett:813) | Reggie Burnett | 15 Dec |