【发布时间】:2017-09-06 17:32:19
【问题描述】:
我使用下面的代码在 accessdb 中创建十进制列,但是当我执行代码时它返回 field definition error
dbname = r'C:/Users/Dhana/Documents/NewDB.accdb'
accApp = Dispatch("Access.Application")
dbEngine = accApp.DBEngine
workspace = dbEngine.Workspaces(0)
dbLangGeneral = ';LANGID=0x0409;CP=1252;COUNTRY=0'
newdb = workspace.CreateDatabase(dbname, dbLangGeneral, 64)
newdb.Execute("""CREATE TABLE AAA (ID COUNTER, Field1 DECIMAL(10,3));""")
但我可以通过访问数据库界面(GUI)创建十进制字段。请帮我解决这个问题。
【问题讨论】:
-
来自allenbrowne.com/ser-49.html 的提示:[DECIMAL] 在 Access 查询界面或 DAO 中不可用。使用 ADO 执行 DDL 查询语句。(不是 100% 确定这是问题所在)
-
@Andre 非常感谢你
标签: python python-2.7 ms-access ms-access-2010 win32com