我有一个Access前端,其中有很多表通过ODBC链接到MySQL后端。我有一个VB.net应用程序,有时会在后端的表中添加列,当发生这种情况时,我需要刷新VB.net应用程序前端表中的链接以显示新列。
我会考虑任何解决方案,只要它不需要重新启动MySQL或Access,并且允许我只刷新我需要刷新的链接(事先我知道)因为有数百个链接和前端的桌子。
答案 0 :(得分:0)
这应该让你开始:
Dim Con As New ADODB.Connection
Dim Cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
Con.Open(m_sAccessDbPath)
Cat.ActiveConnection = Con
' Name the new Table and set its ParentCatalog property
' to the open Catalog to allow access to the Properties
' collection.
tbl.Name = m_sAccessDbTableName
tbl.ParentCatalog = Cat
' Set the properties to create the link.
tbl.Properties("Jet OLEDB:Create Link").Value = True
tbl.Properties("Jet OLEDB:Link Provider String").Value = RemoteDbPath
tbl.Properties("Jet OLEDB:Remote Table Name").Value = RemoteTableName
' Append the table to the Tables collection.
Cat.Tables.Append(tbl)
来源:http://bytes.com/topic/visual-basic-net/answers/370859-create-linked-table-access