本文整理汇总了Python中win32com.client.Dispatch.CommandText方法的典型用法代码示例。如果您正苦于以下问题:Python Dispatch.CommandText方法的具体用法?Python Dispatch.CommandText怎么用?Python Dispatch.CommandText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类win32com.client.Dispatch
的用法示例。
在下文中一共展示了Dispatch.CommandText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: query
# 需要导入模块: from win32com.client import Dispatch [as 别名]
# 或者: from win32com.client.Dispatch import CommandText [as 别名]
def query (query_string, **command_properties):
"""Auxiliary function to serve as a quick-and-dirty
wrapper round an ADO query
"""
command = Dispatch ("ADODB.Command")
command.ActiveConnection = connection ()
#
# Add any client-specified ADO command properties.
# NB underscores in the keyword are replaced by spaces.
#
# Examples:
# "Cache_results" = False => Don't cache large result sets
# "Page_size" = 500 => Return batches of this size
# "Time Limit" = 30 => How many seconds should the search continue
#
for k, v in command_properties.items ():
command.Properties (k.replace ("_", " ")).Value = v
command.CommandText = query_string
recordset, result = command.Execute ()
while not recordset.EOF:
yield ADO_record (recordset)
recordset.MoveNext ()