我有一个 DataGridView 包含在给定时间段(StartDate,EndDate)中制作的(DateStarttasck,TimeStarttasck)和(DateEndtasck,TimeEndtask)的所有点,我尝试计算(DateStarttasck,TimeStarttasck)和( DateEndtasck, TimeEndtask) 期间 (StartDate, EndDate) 注意:DateStarttasck, TimeStarttasck 分别在 DateTimePicker 和 (DateEndtasck, TimeEndtask) (StartDate, EndDate) 中分开,所以我首先考虑在时间和日期,然后计算小时数
Dim sql As String = "select * from task where id_task = " & Textbox1.Text & " and Datetasck Between '" & DateTimePicker1.Text & "' And '" & DateTimePicker2.Text & "';"
command.CommandText = sql
connection.Open()
Dim ds As New DataSet
Dim SQLAdapter As New MySqlDataAdapter(sql, connStr)
SQLAdapter.Fill(ds, "connectString")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "connectString"
DataGridView1.AutoResizeColumns()
connection.Close()