Imports MySql.Data.MySqlClient
Public Class EmployeeInfo

    Dim con As MySqlConnection = _
New MySqlConnection("server=127.0.0.1;user id=root;database=bsit3d")

    Dim cmd As New MySqlCommand
    Dim da As New MySqlDataAdapter
    Dim dt As New DataTable

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    End Sub
    Private Sub display_Click _
(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
        Try

            con.Open()


            dt = New DataTable

            With cmd
                .Connection = con
                .CommandText = "Select * from employeetbl"
            End With

            da = New MySqlDataAdapter("Select * from employeetbl", con)
            da.Fill(dt)

            DataGridView1.DataSource = dt

            Dim max As Integer = DataGridView1.Rows.Count - 1

            DataGridView1.Rows(max).Cells(2).Value = "Total"

            DataGridView1.Rows(max).Cells(3).Value = 0
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

        con.Close()
    End Sub

    Private Sub EmployeeInfo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Start()
        Timer1.Enabled = True
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, _
                            ByVal e As System.EventArgs) Handles Timer1.Tick
        Label1.Text = Date.Now.ToString("MMM dd yyyy hh:mm:ss tt")


    End Sub
End Class

that is all my codes. Im getting a problem connecting to mysql, a message says 'Unable to convert MqSQL date/time value to System.DateTime'
Can anyone help me please ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.