Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I try to bind a mysql database to a datagridview in VB.NET 2010 but I get an error:


Error 40 MYSQL Named Pipeline

When I try to put the MYSQL directly to a datagridview, it works flawlessly.

When I TRY TO PUT THE mysql database to a bindingobject, I get the error.

Remote Access has been enabled, the connectionstring is 1:1 the same so it should work.

How can I solve the problem?

Dim selectCommand As String = "SELECT * FROM `test`"
      Dim connectionString As String = "Server=";User Id=wXXX;Password=tXXXX;Database=aXXXX";
      ' Create a new data adapter based on the specified query.
      Me.dataAdapter = New SqlDataAdapter(selectCommand, connectionString)

          ' Create a command builder to generate SQL update, insert, and
          ' delete commands based on selectCommand. These are used to
          ' update the database.
          Dim commandBuilder As New SqlCommandBuilder(Me.dataAdapter)

          ' Populate a new data table and bind it to the BindingSource.
          Dim table As New DataTable()
          table.Locale = System.Globalization.CultureInfo.InvariantCulture
          Me.bindingSource1.DataSource = table

          ' Resize the DataGridView columns to fit the newly loaded content.

      Me.DataGridView1.DataSource = Me.bindingSource1

What I have tried:

I tried to check for remote access ALLOWANCE and it is enabled. I double check the connection string and it is 1:1 the same like when I try to bind mysql database directly to a datagridview
Updated 27-Sep-16 10:14am

1 solution

To work with MySql databases, you have to download and install MySql connector[^]!

Follow the instruction from this site: Connect Visual Basic .NET to MySql Database[^]

See MySql documentation too: MySQL :: MySQL Connector/Net Developer Guide :: 5.2.1 Opening a Connection[^]
Share this answer

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