1,217
社区成员




Select * From T1 Order by DateTime
Private Sub Form_Load()
Timer1.Interval = 500
End Sub
Private Sub Timer1_Timer()
If Label1.Caption <> CStr(Time$) Then '每秒执行
Label1.Caption = Time$
'数据写入
Dim adoCnn As New ADODB.Connection
Dim adoRst As ADODB.Recordset
Dim sql As String
adoCnn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=TEST;Data Source=PC2010010923NXM"
adoCnn.Open
sql = "insert into T1(DateTime) values('" & DateTime.Now() & "')"
adoCnn.Execute sql
End If
End Sub