本文介绍了如何节省数据库时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我是vb新手
我只想问一下如何将经过的时间存储到数据库中?
我有2种表格
在形式一中,我有一个计时器和一个按钮
hi guys im new in vb
i just want to ask if how can i store the elapsed time to my database?
i have 2 forms
in form one i have a timer and a button
Public Class Form1
Public _elapseTimerRunning As Boolean = False
Public _elapseStartTime As DateTime
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
_elapseStartTime = DateTime.Now
_elapseTimerRunning = True
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
End
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Public Sub Timer1_Tick(sender As Object, e As EventArgs)
''Form_Cert.Label5.Text = Now.ToString("h:mm:ss tt")
If _elapseTimerRunning = True Then
Dim elapsedtime = DateTime.Now.Subtract(_elapseStartTime)
Form2.Label5.Text = String.Format("{0}hr : {1}min : {2}sec", elapsedtime.Hours, elapsedtime.Minutes, elapsedtime.Seconds)
End If
End Sub
End Class
现在,我要在表格2的标签5中显示所花费的时间
我想将数据保存到数据库后吗?
我该怎么办?
THAKS IN ADVANCE
NOW I WANT TO DISPLAY THE ELAPSED TIME IN LABEL 5 OF FORM 2
AFTER THAT I WANT TO SAVE TIT TO MY DB?
HOW CAN I DO THAN?
THAKS IN ADVANCE
推荐答案
这篇关于如何节省数据库时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!