Amazon Affiliate

Tuesday 26 March 2013

ODBC Connectivity with .net and Mysql.


1. First you have to install Mysql Odbc Connector from the below link.
    http://dev.mysql.com/downloads/connector/odbc/
    than install the driver.
2. You have to add DSN (Data Source Name) to the system.
    Procedure to add DSN:
    Control Panel -> Administrative tool -> Data Source ODBC -> Add User DSN -> Select
    Mysql ODBC Driver -> Finish.
     Data Source Name = Name of your DSN
     Description : Leave blank (not manditory)
     TCP/IP Server : localhost
      User : root
      Password : leave blank (not manditory)
      Database : Your database
   
  After that test connection and click ok..
You have successfully create your DSN.

Than you use this DSN to every form which you want to connect with database.
You can use this with create a odbc connection and pass the DSN as the argument.
EX:
      Dim con as new odbc connection("DSN=Your DSN Name")

This code you have to return under the class.

    

No comments:

Post a Comment