Connect Visual Studio to database

Asked

Viewed 338 times

-1

Hello, I am trying to connect my project in Visual Basic, in Visual Studio, with my Mysql database, it presents the error below, would anyone tell me how to solve this problem? I already installed mysql odbc.

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Microsoft.VisualBasic.dll

[Microsoft][ODBC Driver Manager] Nome da fonte de dados não encontrado e nenhum driver padrão especificado

In my code I am importing the ADODB. And I am making the connection as follows:

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    ODB = "Provider=MSDASQL.1;Persist Security Info=False;Extended Properties='DSN=fundacao;DESCRIPTION=fundacao;SERVER=localhost;UID=root;password=11111111;DATABASE=fundacao;PORT=3306'"
End Sub

And you’re making a mistake in that part:

Sub busca_SQL(SQL)

    cox = New ADODB.Connection
    cox.Open(ODB)
    RX = New ADODB.Recordset
    ' MsgBox(SQL)
    '  Debug.Print SQL
    RX.Open(SQL, cox, , LockTypeEnum.adLockOptimistic, -1) 'aqui coloca-se uma "SQL"

End Sub

Follows print: inserir a descrição da imagem aqui

My project is a windows application.

  • Bernardo, copy the error and paste in the question along with the part of the code that is causing the error, the image becomes very difficult to analyze further if it is by stackoverflow application

  • How is your odbc(odbcad) setup? Do you use windows x64 or x86? Does your application run as a service or as a desktop? You put in the ADO correctly the name of the source ODBC?

  • Hello, I am using x64 system. I have an Aplication window. i configured in windows ODBC administrator mysql and the test connection returned success.

1 answer

0


I solved the problem by installing the 32bit Mysql ODBC Connector along with the 64 bit.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.