Advertisement
Guest User

Untitled

a guest
May 15th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. Dim conn As ADODB.Connection
  2. Dim admin As ADODB.Recordset
  3. Dim adm As String
  4.  
  5. Private Sub Form_Load()
  6. connserver
  7. End Sub
  8. Private Sub connserver()
  9. Set conn = New ADODB.Connection
  10. conn.Open "Driver={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=alps;USER=root;PASSWORD=;OPTION=3"
  11. Set admin = New ADODB.Recordset
  12. End Sub
  13.  
  14. Private Sub Command1_Click()
  15. Dim adm As String
  16. Dim myrecord As ADODB.Recordset
  17. Set myrecord = New ADODB.Recordset
  18.  
  19. admin.CursorLocation = adUseClient
  20. adm = "SELECT EmpID, sum(TIMESTAMPDIFF(MINUTE,TimeIn,TimeOut)) as TotalTime FROM `records` where date(TimeIn) like '" & Text1.Text & "' group by EmpID"
  21. admin.Open adm, conn, adoOpenDynamic, adLockBatchOptimistic
  22.  
  23. If admin.EOF = False Then
  24. Set DataGrid1.DataSource = admin
  25. DataGrid1.Refresh
  26. Else
  27. MsgBox "There are no records for " & Text1.Text & "!"
  28. End If
  29.  
  30. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement