Integration dotConnect for MySQL with design-time features of Visual Studio
dotConnect for MySQL integrates tightly with design-time features of Visual Studio 2008, 2010, 2012, 2013, 2015, 2017, and 2019 such as Server Explorer. This is also mentioned as Data Designer Extensibility features, or DDEX. The integration helps to design applications in more convenient and fast way. For example, you can take advantage of DataSet Designer, Data Source wizard, Query Builder, TableAdapter configuration, use Preview Data capability and configure web SqlDataSource component.
This topic provides information on what new features are available and how to use them.
Note that Server Explorer integration is not available for Compact Framework projects and in Visual Studio Express editions except Microsoft Web Developer Express 2008 and 2010.
Integrating with Server Explorer
Server Explorer is the server management console for Visual Studio. Use this window to open data connections and to log on to servers and explore their databases. With Server Explorer you can view and retrieve information from all of the databases you are connected to. Use Server Explorer to list database tables, views, stored procedures, functions, and expand individual nodes to list their columns or arguments. Connections created with Server Explorer are later available in other parts of Visual Studio such as Data Designers.
To access Server Explorer, choose Server Explorer on the View menu.
Add/Modify Connection Dialog Box
This dialog box allows you to create and modify database connections. There are four ways to access this dialog box:
- From the Tools menu select Connect to Database.
- Right-click the Data Connections node in Server Explorer and click Add Connection.
- From the Database menu select Modify Connection.
- Right-click the data connection you want to modify in Server Explorer and click Modify Connection.
The dialog consists of several controls where you supply information needed to connect to server. The following list describes the most important controls.
Host: The name or IP address of host of MySQL database to which to connect.
Port: The port of MySQL database to which to connect. The default value is 3306.
User Id: The MySQL login account.
Password: The password for the MySQL login account.
Allow saving password: If set to true password is stored among the other connection parameters.
Database: Select name of MySQL database you want to connect from drop down list or enter it manually.
List is available only if you specify other connection parameters.
After you fill the controls with data click Test connection button to verify it or click OK button to apply changes and close the dialog.
Advanced Properties dialog box
The Advanced Properties dialog box allows you to specify all properties for the dotConnect for MySQL connection. Invoke this dialog when connecting to Embedded server, using secure connections or advanced options such as pooling and Unicode conversions. The Advanced Properties dialog box appears when you click the Advanced button on the Add Connection, Modify Connection, or New Database Reference dialog boxes.
Design-time integration with project data
Data source wizard
The Data Source Configuration Wizard creates and edits data sources in your application. These data sources can be made from databases, Web services, or objects, and can be bound to controls that display data on forms. After you run the wizard, the data source is available in the Data Sources window for dragging onto forms in Windows applications. For example, the wizard can generate and add DataSet to your project, which can be later customized with TableAdapter Configuration Wizard.
You can run the Data Source Configuration Wizard in any of the following ways:
- Choosing Add New Data Source from the Data menu.
- Choosing Add New Data Source from the Data Sources Window.
- Choosing Add New Data Source from the DataSource property of bindable Windows Forms controls.
When wizard starts, choose Database as data source type, and click Next. Then choose Dataset, and on the next page click the New Connection button. Change data source to MySQL Server, provide logon information and click OK. After that you will have to choose whether to save sensitive information together with other parts of connection string in application configuration file. On the last page of the wizard you select database objects to include in dataset.
On wizard completion you can switch to Solution Explorer to manipulate generated datasets.
TableAdapter configuration
The TableAdapter Configuration Wizard creates and edits TableAdapters. The wizard creates TableAdapters based on SQL statements you enter or on existing stored procedures in the database. The wizard can also create new stored procedures in the database based on SQL statements you enter into the wizard.
A TableAdapter connects to a database, executes queries or stored procedures against a database, and fills a DataTable with the data returned by the query or stored procedure. In addition to filling existing data tables with data, TableAdapters can return new data tables filled with data.
Using parametrized TableAdapter queries
A parametrized query returns data that meets the conditions of a WHERE clause within the query. For example, you can parametrize a customer list to display only customers in a certain city by adding WHERE City = ? to the end of the SQL statement that returns a list of customers. You create parametrized TableAdapter queries in the DataSet Designer, or during creation of data-bound forms in a Windows application with the Parametrize Data Source command on the Data menu. The Parametrize Data Source command also creates controls on your form to input the parameter values and execute the query.
Web SQL data source wizard
This wizard is similar to common Data Source Configuration Wizard. To open it from an ASP.NET Web server control perform the following:
- In Visual Web Developer, create or open an existing .aspx page and then switch to Design view.
- From the Toolbox, drag one of the server controls that support data binding onto the page. For example, from the Standard group of the Toolbox, drag a GridView control onto the page.
- Right-click the control and then click Show Smart Tag.
- In the tasks window, from the Choose Data Source drop-down list, select New data source. (If there is no drop-down list available in the tasks window, click Choose Data Source.)
Getting more help and information
If you experience problems with using Visual Studio windows related to tasks described above just press F1 to open Visual Studio documentation.
If you wish to study more detailed the capabilities of Visual Studio integration you can pay attention to Creating Client Data Applications section in Visual Studio Help. dotConnect for MySQL provides integration capabilities similar to standard data providers.
Back to list