Public con As New ADODB.Connection
Public rs As New ADODB.Recordset
Public pengguna As String
Public Sub buka()
If con.State = 0 Then
con.CursorLocation = adUseClient
con.Open "dsn=ok"
End If
End Sub
Public Sub data(sql As String)
If rs.State = 0 Then rs.Open sql, con, adOpenKeyset, adLockOptimistic
End Sub
-------------------------------------------------
Public CON As New ADODB.Connection
Public strPassword As Integer
Public RS As New ADODB.Recordset
Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Const SW_SHOWNORMAL = 1
Sub Bukakoneksi()
If CON.State = adStateOpen Then CON.Close
CON.OPEN "provider=microsoft.jet.oledb.4.0;data source=" & App.Path + "\database\sensus.mdb"
'MsgBox "koneksi sukses", vbInformation
On Error GoTo conerror
'CON.Open Bukakoneksi
'Exit Sub
conerror:
If Err.Number <> 0 Then
MsgBox Err.Description & vbCrLf & Err.Source, , "Error in connect"
End
End If
End Sub
Sub OpenRec(Sql As String)
If RS.State = adStateOpen Then RS.Close
Debug.Print Sql
RS.OPEN Sql, CON, adOpenKeyset, adLockOptimistic
End Sub
Sub eksekusiSQL(Sql As String)
Debug.Print sqLSTR
CON.Execute Sql
End Sub
Public Function ClearAll(myForm As Form)
Dim CTL As Control
For Each CTL In myForm
If TypeName(CTL) = "TextBox" Then
CTL.Text = ""
End If
If TypeName(CTL) = "MaskEdBox" Then
CTL = " / / "
End If
If TypeName(CTL) = "OptionButton" Then
CTL.Value = False
End If
If TypeName(CTL) = "CheckBox" Then
CTL.Value = 0
End If
Next
End Function
Tidak ada komentar:
Posting Komentar
terimakasih aras kunjungan anda di blog mesujiraya
komentarnya saya tunggu mas bro & mbak sist