Click here to Skip to main content
15,881,516 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to connect my .net application with mysql
pls tell the code to do this
thank you
Posted

Check this[^]

To find proper connection string, visit connectionstrings.com[^]
 
Share this answer
 
1. Download Mysql connector from following link and install
http://dev.mysql.com/downloads/connector/net/[^]
2. Add Reference (MySQL.Data)
3. Namespace
VB
Imports MySql.Data;
Imports MySql.Data.MySqlClient;




4. Connection String
"Server=Localhost;Database=dbTesting;Uid=root;Pwd=password;"
5.

VB
Private Sub ConnectDataBase()
        Try
            Dim con As MysqlDbConnection
            Dim ConStr As String
            
            ConStr = "Server=Localhost;Database=dbTesting;Uid=root;Pwd=password;"

            con = New MYsqlDbConnection(ConStr)

            con.Open()
        Catch ex As Exception
            Throw ex
        End Try
    End Sub
 
Share this answer
 
Comments
anand4886 31-Mar-12 7:17am    
how can i add refrence ,it is showing some error
Manoj Kumar Choubey 31-Mar-12 7:20am    
what error message ?
Manoj Kumar Choubey 31-Mar-12 7:23am    
seehttp://www.linglom.com/2009/03/13/accessing-mysql-on-vbnet-using-mysql-connectornet-part-vi-create-connection/ following link :
http://www.linglom.com/2009/03/13/accessing-mysql-on-vbnet-using-mysql-connectornet-part-vi-create-connection/
anand4886 31-Mar-12 7:25am    
when i select add refrence than a dialog box appears and it contains .net,com,project,browse,recent,which opttion should i search or select
hi there,

but what you want to do? insert , update, delete, search, what?
 
Share this answer
 
Comments
anand4886 31-Mar-12 6:48am    
i want to insert data in the table from vb.net
Aniruddh Bhatt 31-Mar-12 6:49am    
okdo you have a knowledge of query string?
YES/NO
anand4886 31-Mar-12 6:50am    
i have done this with access but i want to do this with mysql
Aniruddh Bhatt 31-Mar-12 6:53am    
okdo you have a insert code for access if yes then you need to change only connection string.
if any query send your code i will solve it.
anand4886 31-Mar-12 6:55am    
i know insert code,pls tell me abt connection string

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900