/* */

Tuesday, November 23, 2010

Re: [belajar-access] MS Acess dengan Database Mysql ???

Nyoba baru sampai disini, sudah ga jalan ...

>> Prosedurnya:
>> >> koneksi tanpa menyebut nama database: scriptnya begini:
>> >>
>> >> 'ini untuk untuk berhubungan dengan MySql
>> >> Dim conb As New ADODB.Connection
>> >> Public Function conbToDB(serverName As String, _
>> >> UserName As String, userPass As String, _
>> >> dbPath As String)
>> >> Dim strCon As String
>> >> On Error GoTo errHandle
>> >>
>> >> strCon = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=" _
>> >> & serverName & ";" & _
>> >> "UID=" & UserName & ";PWD=" & userPass & ";OPTION=16426"
>> >> Set conb = New ADODB.Connection
>> >> conb.Open strCon
>> >> Exit Function
>> >> errHandle:
>> >> MsgBox "SERVER SEDANG TIDAK AKTIF", , "NON AKTIF"
>> >> conb.Close
>> >> Set conb = Nothing
>> >> End Function
>> >>
>> >> 'Terus lanjutkan dengan dengan ini:
>> >>
>> >> Function KONEKSIS()
>> >> conbToDB "isi hostname/localhost/ip", "isi dengan username", "isi
>> >> dengan
>> >> password", 3306
>> >> End Function
>> >>
>> >> 'Lalu kita jalankan fungsi itu dengan memanggilnya, misalnya:
>> >>
>> >> Private Sub Command0_Click()
>> >> KONEKSIS
>> >> If conb.State <> 0 Then
>> >> conb.Execute "create database IF Not EXISTS conto_rek"
>> >> MsgBox "sukses membuat database dengan nama conto_rek di MySql"
>> >> Else
>> >> MsgBox "gagal membuat database di MySql"
>> >> End If
>> >>
>> >> conb.Close
>> >> Set conb = Nothing
>> >> End Sub
>> >>

Muncul debug "Object Required" .....

If conb.State <> 0 Then --->berwarna kuning.


------------------------------------

SPAM IS PROHIBITEDYahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/belajar-access/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/belajar-access/join
(Yahoo! ID required)

<*> To change settings via email:
belajar-access-digest@yahoogroups.com
belajar-access-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
belajar-access-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

No comments:

Post a Comment