Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
.NET Framework
Tabelle Collegate
giovedì 16 giugno 2005 - 12.48
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
secks
Profilo
| Senior Member
442
messaggi | Data Invio:
gio 16 giu 2005 - 12:48
Qualcuno sa come fare in VB.NET un "Collega Tabelle" su MDB di ACCESS?
Grazie e Ciao.
Paolo.
Cteniza
Profilo
| Guru
1.509
messaggi | Data Invio:
gio 16 giu 2005 - 13:57
Devi immettere un riferimento ad ado ed a adox
Dim cat As New ADOX.Catalog
Dim cnAccess As New ADODB.Connection
Private Function CancellaTable(ByVal pTable As String) As Boolean
Try
cat.Tables.Delete(pTable)
Return True
Catch ex As Exception
Return False
End Try
End Function
Private Sub ApriConnessione(ByVal pDataBase As String)
cnAccess.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pDataBase + ";")
cat.let_ActiveConnection(cnAccess)
End Sub
Private Sub ChiudiConnessione()
cat = Nothing
cnAccess.Close()
cnAccess = Nothing
End Sub
Private Function CreaLinkTable(ByVal pTable As String, ByVal pCat As ADOX.Catalog, ByVal pDataSource As String) As Boolean
'pTable = nome tabella
'pCat = oggetto ADOX.Catalog
'pDataSource = "dove" linkare es: "C:\access\northwind.mdb"
Dim tbl As New ADOX.Table
Try
tbl.Name = pTable
tbl.ParentCatalog = pCat
tbl.Properties("Jet OLEDB:Link Datasource").Value = pDataSource
tbl.Properties("Jet OLEDB:Remote Table Name").Value = "Clienti"
tbl.Properties("Jet OLEDB:Create Link").Value = True
pCat.Tables.Append(tbl)
tbl.Properties("Jet OLEDB:Link Datasource").Value = pDataSource
'ho visto che in alcuni casi è opportuno riscriverlo
Return True
Catch ex As Exception
Return False
End Try
End Function
Cteniza
Profilo
| Guru
1.509
messaggi | Data Invio:
gio 16 giu 2005 - 14:00
Naturalmente devi apportare una piccola correzione:
Private Function CreaLinkTable(ByVal pTable As String, ByVal pCat As ADOX.Catalog, ByVal pDataSource As String, ByVal pTableEsterna As String) As Boolean
'pTable = nome tabella
'pCat = oggetto ADOX.Catalog
'pDataSource = "dove" linkare es: "C:\access\northwind.mdb"
'pTableEsterna = tabella del database remoto es: Clienti
Dim tbl As New ADOX.Table
Try
tbl.Name = pTable
tbl.ParentCatalog = pCat
tbl.Properties("Jet OLEDB:Link Datasource").Value = pDataSource
tbl.Properties("Jet OLEDB:Remote Table Name").Value = pTableEsterna
tbl.Properties("Jet OLEDB:Create Link").Value = True
pCat.Tables.Append(tbl)
tbl.Properties("Jet OLEDB:Link Datasource").Value = pDataSource
'ho visto che in alcuni casi è opportuno riscriverlo
Return True
Catch ex As Exception
Return False
End Try
End Function
secks
Profilo
| Senior Member
442
messaggi | Data Invio:
gio 16 giu 2005 - 14:42
1000 grazie!
astroman
Profilo
| Junior Member
105
messaggi | Data Invio:
lun 26 mar 2007 - 12:54
Ciao,
sto provando ad utilizzare l'esempio ma non riesco a capire quali sono i riferimenti ado e adox da importare nel progetto...sto usando vsstudio 2005, net 2.0 e windows vista come s.o.
Grazie :)
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !