VB.net with Crystal Report and MySQL using ADO & ODBC.

VB.net with Crystal Report and MySQL using ADO & ODBC.

Before we begin, to use MySQL with VB.NET you will need to download the MySQL Connector/NET which is available from
http://dev.mysql.com.../connector/net/. At the time of writing, the newest version is 6.1. The installer will install
the ADO connector on your system ready for use.
restart visual studio.

Once the connector is installed, start a new project in VB.NET (Im using 2008) and you will then need to add a reference to the connector.

Choose "Add Reference" from the Project menu, then select "Browse" and browse to the installation folder where the connector was installed, c:\prog files\mysql\asemblies\
choose "MySQL.Data.dll" .

For ODBC Connector install


In Administrative Tools, click Data Sources (ODBC).

Open the ODBC Data Source Administrator.
To create a System DSN (which will be available to all users) , select the System DSN tab. To create a User DSN, which will be unique only to the current user, click the Add... button.
You will need to select the ODBC driver for this DSN.
  • Now fill in connection information about how to connect to a database in MySQL.
  • Data Source Name: A unique name here to identify this data source. It has nothing to do with any system names. Just make up a name that you think is appropriate. Here we type in myodbc.
  • Description: A brief description about this data source.
  • Server: Host name or IP address of the MySQL server. The default is localhost.
  • User: The MySQL username used to connect to MySQL server. Normally you can username root. Make sure you have installed MySQL server. Refer to MySQL installation guide here.
  • Password: The password for the User. Type in the password of root user.
  • Database: The default database name used when connecting to MySQL server. Click the drop-down box and select the database you need to connect to.

Test Connection.

Now create new crystal report.
To start the wizard, open Crystal Reports and choose the New > Standard Report option from the File menu.

The wizard will first prompt you for a data source. If you are using Connector/ODBC as your data source, use the OLEDB provider for ODBC option from the OLE DB (ADO) tree instead of the ODBC (RDO) tree when choosing a data source. If using a saved data set, choose the ADO.NET (XML) option and browse to your saved data set.


thamizh mani said…
hi, u r blogger was great helpful for me .. to learn abt MYSQL....
Surendran V said…
Surendran V said…
This is very useful for me on desktop,but it shows error while working with 64 bit laptop where i installed 5.2.6 .msi for 64 bit.It gives error when I click on command buuton for integreted security.I am having 'root' as username and password is blank.

Most Viewed Post

solution for facebook static.ak.fbcdn.net waiting

Connect Sony XPLOD MEX-BT2500 Bluetooth CD Receiver with ur mobile

Crystal Report : Show data horizontally (Left to right) i.e. columns as rows