SKTIME GATIME
20101108161900 20101111144842
20101111115200 20101111144842
20101111141500 20101111144842
20101111141600 20101111144848
20101111145000 20101111152217
20101111145000 20101111152223
20101111152500 20101111152657
20101111152500 20101111152703
20101111154000 20101112145853
20101111154300 20101112145853
20101111160100 20101112145853
20101111161800 20101112145853
20101111162400 20101112145853
20101111162400 20101112145853
20101111163000 20101112145853
20101111163000 20101112145853
20101111171100 20101112145853
20101111193800 20101112145853
20101111193800 20101112145853
20101111200500 20101112145853
20101111201400 20101112145853
20101111233800 20101112145853
20101111234600 20101112145853
Private Sub CommandButton2_Click()
Dim i As Integer, j As Integer, sht As Worksheet
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cm As New ADODB.Connection
Dim strcn As String, strsql As String
Dim a As Integer, b As Integer
strcn = "provider=sqloledb;server=192.168.1.109;database=cardsd;uid=sa;pwd=111111;"
strsql = "select * from YSSKKQ "
cn.Open strcn
rs.Open strsql, cn
i = 5
Set sht = ActiveWorkbook.Worksheets("基础数据")
Do While Not rs.EOF
sht.Cells(i, 1) = rs("id")
sht.Cells(i, 2) = rs("empno")
sht.Cells(i, 3) = rs("cardno")
sht.Cells(i, 4) = rs("cardtype")
sht.Cells(i, 5) = rs("sktime")
sht.Cells(i, 6) = rs("gatime")
rs.MoveNext '把指针移向下一条记录
i = i + 1
Loop
rs.Close
cn.Close
End Sub
上面这两排是从数据库中取出来的数据,左边是开始时间,右边是结束时间。能不能说得更详细一点,谢谢。用户名:admin, 密码:123
2012-8-7 09:13 上传
点击文件名下载附件
226.43 KB, 下载次数: 75