0
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

Edited by rucel jhalia: mistaken

1
Contributor
1
Reply
4
Views
2 Years
Discussion Span
Last Post by rucel jhalia
0

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 ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.