W walimg Unregistered / Unconfirmed GUEST, unregistred user! 2010-04-26 #1 用:ADOConnection1连接,现在求用一条SQL语句修改Access数据库的表名.不用复制到新表后删除旧表的方法。谢谢这句不行。ALTER TABLE t1 RENAME t2;
V Vsun Unregistered / Unconfirmed GUEST, unregistred user! 2010-04-26 #2 SQL语句是不能改ACCESS数据库中的表名的,要借助ADOX.Catalog。引用ComObj单元var CatalogObj: Variant;begin CatalogObj := CreateOleObject('ADOX.Catalog'); CatalogObj.ActiveConnection := 'Provider = Microsoft.Jet.OLEDB.4.0; Data Source = ./blog.mdb'; CatalogObj.tables['旧表名'].Name := '新表名'; CatalogObj := null;end;
SQL语句是不能改ACCESS数据库中的表名的,要借助ADOX.Catalog。引用ComObj单元var CatalogObj: Variant;begin CatalogObj := CreateOleObject('ADOX.Catalog'); CatalogObj.ActiveConnection := 'Provider = Microsoft.Jet.OLEDB.4.0; Data Source = ./blog.mdb'; CatalogObj.tables['旧表名'].Name := '新表名'; CatalogObj := null;end;