MySQL Connector/Net Developer Guide


This manual describes how to install and configure MySQL Connector/Net, the driver that enables .NET applications to communicate with MySQL servers, and how to use it to develop database applications.

For notes detailing the changes in each release of Connector/Net, see MySQL Connector/Net Release Notes.

For legal information, see the Legal Notices.

For help with using MySQL, please visit either the MySQL Forums or MySQL Mailing Lists, where you can discuss your issues with other MySQL users.

For additional documentation on MySQL products, including translations of the documentation into other languages, and downloadable versions in variety of formats, including HTML and PDF formats, see the MySQL Documentation Library.

Document generated on: 2016-02-05 (revision: 46397)

Table of Contents

Preface and Legal Notices
1 Introduction to MySQL Connector/Net
2 Connector/Net Versions
3 Connector/Net Installation
3.1 Installing Connector/Net on Windows
3.1.1 Installing Connector/Net Using MySQL Installer
3.1.2 Installing Connector/Net Using the Standalone Installer
3.2 Installing Connector/Net on Unix with Mono
3.3 Installing Connector/Net from the Source Code
4 Connector/Net Visual Studio Integration
4.1 Installing and Configuring
4.2 Making a Connection
4.3 The MySQL Toolbar
4.4 Item Templates versus Project Templates
4.5 Using IntelliSense in the SQL Editor
4.6 Editing Tables
4.6.1 Column Editor
4.6.2 Editing Indexes
4.6.3 Editing Foreign Keys
4.6.4 Column Properties
4.6.5 Table Properties
4.7 Editing Views
4.8 Editing Stored Procedures and Functions
4.9 Editing Triggers
4.10 Debugging Stored Procedures and Functions
4.11 Deleting Database Objects
4.12 Using the ADO.NET Entity Framework
4.13 MySQL Website Configuration Tool
4.14 MySQL Project Items
4.14.1 Requirements
4.14.2 MySQL ASP.NET MVC Items
4.14.3 MySQL Windows Forms Items
4.15 MySQL SQL Editor
4.16 MySQL Data Export Tool
4.17 DDL T4 Template Macro
5 Connector/Net Tutorials
5.1 Tutorial: An Introduction to Connector/Net Programming
5.1.1 The MySqlConnection Object
5.1.2 The MySqlCommand Object
5.1.3 Working with Decoupled Data
5.1.4 Working with Parameters
5.1.5 Working with Stored Procedures
5.2 Tutorial: MySQL Connector/Net ASP.NET Membership and Role Provider
5.3 Tutorial: MySQL Connector/Net ASP.NET Session State Provider
5.4 Tutorial: MySQL Connector/Net ASP.NET Profile Provider
5.5 Tutorial: Web Parts Personalization Provider
5.6 Tutorial: Simple Membership Web Provider
5.6.1 Requirements
5.6.2 Creating and Configuring a New Project
5.6.3 Adding OAuth Authentication to a Project
5.7 Tutorial: Using an Entity Framework Entity as a Windows Forms Data Source
5.8 Tutorial: Databinding in ASP.NET Using LINQ on Entities
5.9 Tutorial: Using SSL with MySQL Connector/Net
5.10 Tutorial: Using MySqlScript
5.10.1 Using Delimiters with MySqlScript
5.11 Tutorial: Generating MySQL DDL from an Entity Framework Model
6 Connector/Net Programming
6.1 Connecting to MySQL Using Connector/Net
6.2 Creating a Connector/Net Connection String
6.2.1 Opening a Connection
6.2.2 Handling Connection Errors
6.2.3 Using GetSchema on a Connection
6.3 Using MySqlCommand
6.4 Using Connector/Net with Connection Pooling
6.5 Using the Windows Native Authentication Plugin
6.6 Writing a Custom Authentication Plugin
6.7 MySQL Fabric Support
6.8 Using Connector/Net with Table Caching
6.9 Using the Connector/Net with Prepared Statements
6.9.1 Preparing Statements in Connector/Net
6.10 Accessing Stored Procedures with Connector/Net
6.10.1 Using Stored Routines from Connector/Net
6.11 Handling BLOB Data With Connector/Net
6.11.1 Preparing the MySQL Server
6.11.2 Writing a File to the Database
6.11.3 Reading a BLOB from the Database to a File on Disk
6.12 Asynchronous methods
6.13 Using the Connector/Net Interceptor Classes
6.14 Handling Date and Time Information in Connector/Net
6.14.1 Fractional Seconds
6.14.2 Problems when Using Invalid Dates
6.14.3 Restricting Invalid Dates
6.14.4 Handling Invalid Dates
6.14.5 Handling NULL Dates
6.15 Using the MySqlBulkLoader Class
6.16 Using the MySQL Connector/Net Trace Source Object
6.16.1 Viewing MySQL Trace Information
6.16.2 Building Custom Listeners
6.17 Binary/Nonbinary Issues
6.18 Character Set Considerations for Connector/Net
6.19 Using Connector/Net with Crystal Reports
6.19.1 Creating a Data Source
6.19.2 Creating the Report
6.19.3 Displaying the Report
6.20 ASP.NET Provider Model
6.21 Working with Partial Trust / Medium Trust
6.21.1 Evolution of Partial Trust Support Across Connector/Net Versions
6.21.2 Configuring Partial Trust with Connector/Net Library Installed in GAC
6.21.3 Configuring Partial Trust with Connector/Net Library Not Installed in GAC
7 Connector/Net Connection String Options Reference
8 Connector/Net Support for Windows Store
9 EF 5 Support
10 EF 6 Support
11 Connector/Net API Reference
11.1 MySql.Data.MySqlClient Namespace
11.1.1 MySql.Data.MySqlClientHierarchy
11.1.2 BaseCommandInterceptor
11.1.3 BaseExceptionInterceptor
11.1.4 MySqlCommand Class
11.1.5 MySqlCommandBuilder Class
11.1.6 MySqlException Class
11.1.7 MySqlHelper Class
11.1.8 MySqlErrorCode Enumeration
11.2 MySql.Data.Types Namespace
11.2.1 MySql.Data.TypesHierarchy
11.2.2 MySqlConversionException Class
11.2.3 MySqlDateTime Class
12 Connector/Net Support
12.1 Connector/Net Community Support
12.2 How to Report Connector/Net Problems or Bugs
13 Connector/Net FAQ
A Licenses for Third-Party Components
A.1 ANTLR 3.3 License
A.2 Bouncy Castle 1.7 License
A.3 Google Protocol Buffers - C# Port - License
A.4 Json.NET (Newtonsoft.Json)
A.5 RFC 3174 - US Secure Hash Algorithm 1 (SHA1) License
A.6 ScintillaNET License
A.7 SSH.NET Library License
A.8 zlib License
A.9 ZLIB.NET License