如何使用Dispatch命令获取数据库列表数据库控制')?

2024-06-12 10:45:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用pif提供程序,我需要提取数据库列表在我的PIAF服务器时,我呼吁oConn.GetSchema我大声吼叫。请告诉我我的代码有什么问题。你知道吗

from win32com.client import Dispatch

oConn = Dispatch('ADODB.Connection')
oRS = Dispatch('ADODB.RecordSet')
oConn.ConnectionString = "Provider=PIOLEDBENT; Data Source=localhost; Integrated Security=True; Integrated Security=True;User ID=abubakr;Password=#Spark123!"
oConn.Open()
oConn.GetSchema();

例外情况:

pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'ADODB.Connection', u'Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.', u'C:\\Windows\\HELP\\ADO270.CHM', 1240641, -2146825287), None)

Tags: of程序数据库true列表connectionaredispatch