我想将Access数据库添加到我的Visio文档中。 MSN示例显示连接到Excel文档的字符串。我将使用什么来连接Access DB?
我正在使用:
Microsoft Visio 2013
Microsoft Access 2013
Microsoft Windows 7 Enterprise。
数据库位置:
C:\用户\ j.Smith \桌面\ access_file.mdb
我的剧本:
Public Sub AddDataRecordset_Example()
Dim strConnection As String
Dim strCommand As String
Dim strOfficePath As String
Dim vsoDataRecordset As Visio.DataRecordset
strOfficePath = Visio.Application.Path
strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" _
& "User ID=Admin;" _
& "Data Source=" + strOfficePath + "SAMPLES\1033\ORGDATA.XLS;" _
& "Mode=Read;" _
& "Extended Properties=""HDR=YES;IMEX=1;MaxScanRows=0;Excel 12.0;"";" _
& "Jet OLEDB:Engine Type=34;"
strCommand = "SELECT * FROM [Sheet1$]"
Set vsoDataRecordset = ActiveDocument.DataRecordsets.Add(strConnection, strCommand, 0, "Org Data")
End Sub
答案 0 :(得分:1)
这应该这样做:
df1= pandas.DataFrame([[0,1,3],[4,2,5],[6,3,1],[8,0,0],[2,1,1]], columns = ['A', 'B', 'C'])
df2= pandas.DataFrame([4,6,1], columns = ['A'])
df2.merge(df1, on = 'A')
请注意表名周围的单引号。
另外,fyi,我总是发现以下网站非常有用:ConnectionStrings