gpt4 book ai didi

mysql - MonthCalendar 中的粗体数据库日期

转载 作者:行者123 更新时间:2023-11-30 22:30:12 26 4
gpt4 key购买 nike

当有事件保存到特定日期时,我试图将我的日历编号加粗。我已经搜索并尝试这样做,但我做不到。

当我将事件保存到所选日期时,如何将日期设为粗体?

这是我尝试做的,但它无法转换为日期的一维数组。

mydbcon = New MySqlConnection
mydbcon.ConnectionString = "server=localhost;userid=root;password=root;database=database"
Dim reader As MySqlDataReader
Dim bold = Form4.MonthCalendar1.SelectionRange.Start.Month
Try
mydbcon.Open()
Dim Query As String
Query = "Insert into database.calendar (eventname,Date,Time,Description) Values ('" & TextBox2.Text & "','" & Form4.MonthCalendar1.SelectionRange.Start & "','" & ComboBox1.SelectedItem & "','" & TextBox1.Text & "')"
COMMAND = New MySqlCommand(Query, mydbcon)
reader = COMMAND.ExecuteReader
MessageBox.Show("Event Succesfully Saved")

Form4.MonthCalendar1.BoldedDates = bold
mydbcon.Close()
Catch ex As MySqlException
MessageBox.Show(ex.Message)
Finally
mydbcon.Dispose()
End Try

最佳答案

向日历添加粗体日期 - 示例:

    MonthCalendar1.AddBoldedDate(CDate("03-12-2015"))
MonthCalendar1.UpdateBoldedDates()

从数据库中读取日期 - 示例:

    mydbcon = New MySqlConnection
mydbcon.ConnectionString = "server=localhost;userid=root;password=root;database=database"
Dim reader As MySqlDataReader

Try
mydbcon.Open()
Dim Query As New MySql.Data.MySqlClient.MySqlCommand
Dim eventDate As String
Query.Connection = mydbcon
Query.CommandText = "SELECT Date FROM database ORDER BY Date"
reader = Query.ExecuteReader

If reader.HasRows = True Then
While reader.Read
eventDate = reader.GetValue(reader.GetOrdinal("Date")).ToShortDateString
MonthCalendar1.AddBoldedDate(CDate(eventDate))
End While
reader.Close()
MonthCalendar1.UpdateBoldedDates()
End If

mydbcon.Close()
Catch ex As MySqlException
MessageBox.Show(ex.Message)
Finally
mydbcon.Dispose()
End Try

关于mysql - MonthCalendar 中的粗体数据库日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34065996/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com