VB.Net Show Date From MySQL To DateTimePicker
How To Display Date From MySQL DataBase To DateTimePicker In VbNet
In This VB.Net Tutorial We Will See How To Get Date From MySQL DataBase And Set It Into A DateTimePicker Using MySqlDataReader And Custom The Date Format Using CustomFormat In Visual Basic.Net Programming Language And Visual Studio Editor.
Project Source Code:
Imports MySql.Data.MySqlClient
Public Class Display_Date_From_MySQL_To_DateTimePicker
Private Sub Display_Date_From_MySQL_To_DateTimePicker_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim connection As New MySqlConnection("datasource=localhost;port=3306;username=root;password=")
Dim command As New MySqlCommand()
command.CommandText = "SELECT `Id`, `FullName`, `Address`, `BirthDate` FROM s_t_d.student WHERE `Id` = 1"
command.Connection = connection
Dim reader As MySqlDataReader
connection.Open()
reader = command.ExecuteReader
reader.Read()
'DateTimePicker1.CustomFormat = "yyyy-MM-dd"
DateTimePicker1.Value = reader(3)
connection.Close()
End Sub
End Class
///////////////OUTPUT:
Posting Komentar untuk "VB.Net Show Date From MySQL To DateTimePicker"