coba dengan kode ini mas ini punya pak harianto
untuk koneksi MySQL odbc moga bermanfaat
Option Compare Database
Option Explicit
Public conn As New ADODB.Connection
Private Const MAX_COMPUTERNAME As Long = 15
Private Declare Function GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" _
(ByVal lpBuffer As String, _
nSize As Long) As Long
Private Function TrimNull(item As String)
Public conn As New ADODB.Connection
Private Const MAX_COMPUTERNAME As Long = 15
Private Declare Function GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" _
(ByVal lpBuffer As String, _
nSize As Long) As Long
Private Function TrimNull(item As String)
'return string before the terminating null
Dim pos As Integer
pos = InStr(item, Chr$(0))
If pos Then
TrimNull = Left$(item, pos - 1)
Else
TrimNull = item
End If
End Function
Dim pos As Integer
pos = InStr(item, Chr$(0))
If pos Then
TrimNull = Left$(item, pos - 1)
Else
TrimNull = item
End If
End Function
Function KOM()
Dim tas As String
'pre-load the text boxes with
'the local computer name for testing
tas = Space$(MAX_COMPUTERNAME + 1)
Call GetComputerName(tas, Len(tas))
KOM = TrimNull(tas)
If KOM Like "*-*" Then
KOM = Replace(KOM, "-", "_")
End If
End Function
Public Function connToDB(ServerName As String, _
UserName As String, userPass As String, _
dbPath As String, dbName As String)
Dim tas As String
'pre-load the text boxes with
'the local computer name for testing
tas = Space$(MAX_COMPUTERNAME + 1)
Call GetComputerName(tas, Len(tas))
KOM = TrimNull(tas)
If KOM Like "*-*" Then
KOM = Replace(KOM, "-", "_")
End If
End Function
Public Function connToDB(ServerName As String, _
UserName As String, userPass As String, _
dbPath As String, dbName As String)
Dim strCon As String
On Error GoTo errHandle
strCon = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=" _
& ServerName & ";DATABASE=" & dbName & ";" & _
"UID=" & UserName & ";PWD=" & userPass & ";OPTION=16426"
strCon = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=" _
& ServerName & ";DATABASE=" & dbName & ";" & _
"UID=" & UserName & ";PWD=" & userPass & ";OPTION=16426"
Set conn = New ADODB.Connection
conn.Open strCon
conn.Open strCon
Exit Function
errHandle:
MsgBox "SERVER SEDANG TIDAK AKTIF", , "NON AKTIF"
conn.Close
Set conn = Nothing
End Function
MsgBox "SERVER SEDANG TIDAK AKTIF", , "NON AKTIF"
conn.Close
Set conn = Nothing
End Function
Function koneksi()
connToDB "localhost", "root", "lkjlkj", 3306, "NUPTK_0614"
End Function
connToDB "localhost", "root", "lkjlkj", 3306, "NUPTK_0614"
End Function
Public Function SqlSafe(strInput As String) As String
SqlSafe = Replace(strInput, "'", "''")
SqlSafe = Replace(SqlSafe, """", """""")
End Function
SqlSafe = Replace(strInput, "'", "''")
SqlSafe = Replace(SqlSafe, """", """""")
End Function
From: Azkia Shabrina <azkia.shabrina@yahoo.co.id>
To: belajar-access@yahoogroups.com
Sent: Sunday, May 19, 2013 7:03 PM
Subject: Re: [belajar-access] Re: koneksi otomatis ke ODBC
To: belajar-access@yahoogroups.com
Sent: Sunday, May 19, 2013 7:03 PM
Subject: Re: [belajar-access] Re: koneksi otomatis ke ODBC
Azkia punya juga sekali saja diawal dicentang sudah tak tanya tanya lagi pula
From: aksan kurdin
Sent: Sunday, May 19, 2013 4:01 PM
Subject: Re: [belajar-access] Re: koneksi otomatis ke ODBC
ah masak,aplikasi aku ke mysql tidak begitu ....sudah tak tanya2 password lagi ...:)coba dengan mdb/accdb baru test dulu ...aksan kurdinOn 5/19/2013 10:23 AM, al.joens wrote:
Tetap minta password bang tiap kali membuka aplikasi meskipun pada awalnya password nya disimpan, gimana bang apa ada solusi yang lain, terima kasih.
--- In mailto:belajar-access%40yahoogroups.com, aksan kurdin mailto:aksan.kurdin@... wrote:
>
> cara mudah pada saat bikin odbc koneksi di access, pilih save passwordnya.
>
>
>
>
> aksan kurdin
>
> On 5/17/2013 11:06 AM, al.joens wrote:
> >
> > mohon bantuannya pada master and suhu access,bagaimana ya cara membuat
> > kode koneksi otomatis dari access ke sqlserver 2005 melalui koneksi
> > ODBC sehingga tiap kali user mengakses aplikasi tidak perlu harus
> > memasukkan pasword-aplikasi langsung jalan-.
> >
> > demikian , atas bantuannya kami sampaikan beribu-ribu terima kasih.
> >
> >
>
__._,_.___
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (13) |
SPAM IS PROHIBITED
.
__,_._,___
Tidak ada komentar:
Posting Komentar