Dear All
Waktu saya googling tentang DSN-Less saya nemu artikel di :
http://blogs.msdn.com/b/spike/archive/2009/11/24/how-to-create-a-dns-less-linked-server-in-access-to-sql-server.aspx
di situ dijelaskan cara koneksi DSN-Less link table Access to SQL Server dengan code sbb :
Sub DnsLessLinkTable()
Dim con As ADODB.Connection
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Set con = New ADODB.Connection
Set cat = New ADOX.Catalog
Set tbl = New ADOX.Table
cat.ActiveConnection = CurrentProject.Connection
' Create the new (linked) table. Give it an appropriate name,
tbl.Name = "NoDnsEmployees"
Set tbl.ParentCatalog = cat
' Set the properties to create the linked table, Make sure you have a working connection string
tbl.Properties("Jet OLEDB:Link Provider String") = "ODBC;Driver={SQL Server};Server=servername\instancename;Database=Northwind;Uid=user;Pwd=password;"
' Select table in remote database, in this example, Employees table in Northwind Database
tbl.Properties("Jet OLEDB:Remote Table Name") = "Employees"
tbl.Properties("Jet OLEDB:Create Link") = True
' Append the table to the Tables collection.
cat.Tables.Append tbl
Set cat = Nothing
End Sub
Setelah saya coba (mengunakan access 2003 & sql server express 2005) memang berhasil terjadi link table access sql server.
Yang saya tanyakan adalah :
- Apakah ini benar koneksi DSN-Less link table Access to SQL Server atau Cuma sebagian kode saja dan bagaimana maksud/ alur coding-nya?
- Setelah kode saya jalankan Cuma ada satu table (table Employess) yang berhasil menjadi link table access-sql server, jika kita mempunyai banyak table bagaimana caranya/ merubah baris kodenya?
apakah semua tabel harus kita tulis?
Mohon penjelasan para master semua.
Mungkin bang Opi atau mas Hendra atau master yang lain bisa menjelaskan?
Salam Access,,
Adi
Minggu, 12 Agustus 2012
[belajar-access] Tanya DSN-Less
__._,_.___
SPAM IS PROHIBITED
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar