none
Issue with CommandBuilder RRS feed

  • Question

  • Hello ! I would really like to use your code ! but it doesnt seems to work for me 

    Here is what i have : 

    Imports System.Data.SqlClient
    Imports MySql.Data
    Imports MySql.Data.MySqlClient
    
    Public Class Form1
        Dim ds As DataSet
        Dim cmd As SqlCommandBuilder
        Dim sqldata As MySqlDataAdapter
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Try
                cmd = New MySqlCommandBuilder(sqldata)
                sqldata.Fill(ds, "Test1")
                MessageBox.Show("Update success!")
            Catch ex As Exception
    
            End Try
        End Sub
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            loadata()
        End Sub
        Private Sub loadata()
            Try
                Dim ConnectionString As String = "Server=localhost;Database=matcom;Uid=root;Pwd=;"
                Dim con As New MySqlConnection(ConnectionString)
                con.Open()
                sqldata = New MySqlDataAdapter("select ID, columnname,columnsex, columnage from test2", con)
                ds = New DataSet()
                sqldata.Fill(ds, "Test1")
                DataGridView1.DataSource = ds.Tables(0)
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
        End Sub
    End Class
    

    And here is the error it gives me : Impossible to convert from MySqlCommandBuilder to SqlCommandBuilder

    Could you please send me your project ? (.sln) at maxence.caso34@gmail.com

    I'm new in coding and i'm trying to learn, Thanks you

    Tuesday, May 21, 2019 8:52 AM

All replies

  • Hello,

    Please replace SqlCommandBuilder with MySqlCommandBuilder. See if that clears up "Impossible to convert from MySqlCommandBuilder to SqlCommandBuilder"


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Tuesday, May 21, 2019 10:17 AM
    Moderator