Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim conn As ADODB.Connection
- Dim admin As ADODB.Recordset
- Dim adm As String
- Private Sub Form_Load()
- connserver
- End Sub
- Private Sub connserver()
- Set conn = New ADODB.Connection
- conn.Open "Driver={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=alps;USER=root;PASSWORD=;OPTION=3"
- Set admin = New ADODB.Recordset
- End Sub
- Private Sub Command1_Click()
- Dim adm As String
- Dim myrecord As ADODB.Recordset
- Set myrecord = New ADODB.Recordset
- admin.CursorLocation = adUseClient
- adm = "SELECT EmpID, sum(TIMESTAMPDIFF(MINUTE,TimeIn,TimeOut)) as TotalTime FROM `records` where date(TimeIn) like '" & Text1.Text & "' group by EmpID"
- admin.Open adm, conn, adoOpenDynamic, adLockBatchOptimistic
- If admin.EOF = False Then
- Set DataGrid1.DataSource = admin
- DataGrid1.Refresh
- Else
- MsgBox "There are no records for " & Text1.Text & "!"
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement