用VFP列出ACCESS所有表的字段结构,含标题。
来源:互联网 发布:亿人围观网络春晚 编辑:程序博客网 时间:2024/06/04 15:59
set safety off
local oo,lcStr,lcMdbFile,i,x,lnFields,lcTableName,lnFieldtype,lcCurdir
lcCurdir = sys(5) + curdir()
lcNowdir = getdir()
cd (lcNowdir)
oo = NEWOBJECT('Access.Application')
oo.AutomationSecurity = 1
oo.UserControl = .F.
lcMdbFile = getFile('mdb')
if not empty(lcMDBFile)
oo.OpenCurrentDatabase(lcMDBFile)
lnTables = oo.CurrentDb.TableDefs.Count
for i = 5 to lnTables - 1
lcStr = ''
lnFields = oo.CurrentDb.TableDefs(i).fields.count
*lcTableName = JUSTSTEM(lcMDBFile) + '_' + oo.CurrentDb.TableDefs(i).Name
lcTableName = oo.CurrentDb.TableDefs(i).Name
*use
if i = 5
* create Table (lcTableName) (字段名 char(10),类型 char(10),宽度 char(4),小数位 char(4),标题 char(50),对应字段 char(20))
create Table blank (字段名 char(9),类型 char(10),宽度 char(2),小数位 char(4),标题 char(24),对应字段 char(20),表名 char(10))
endif
for x = 0 to lnFields - 1
append blank
lnFieldType = oo.CurrentDb.TableDefs(i).Fields(x).type
do case
case lnFieldType = 10
lcType = '字符型'
case lnFieldType = 5
lcType = '货币型'
case lnFieldType = 8
lcType = '日期时间型'
case lnFieldType = 3
lcType = '整型'
case lnFieldType = 6
lcType = '单精度型'
otherwise
lcType = ltrim(str(oo.CurrentDb.TableDefs(i).Fields(x).type))
endcase
replace 字段名 with oo.CurrentDb.TableDefs(i).Fields(x).name
replace 类型 with lcType
replace 宽度 with ltrim(str(oo.CurrentDb.TableDefs(i).Fields(x).size))
if inlist(lnFieldType,3,5,6)
lnValue = oo.Currentdb.TableDefs(i).Fields(x).Properties('DecimalPlaces').Value
replace 小数位 with icase(lnValue = 255,'自动',alltrim(str(lnValue)))
endif
replace 标题 with oo.CurrentDb.TableDefs(i).Fields(x).Properties('caption').value
replace 表名 with lcTableName
endfor
*copy To (lcTableName) type xl5
*use
endfor
endif
oo.CloseCurrentDatabase()
oo = null
cd (lcCurdir)
在此感谢“都市夜猫”的指导。
- 用VFP列出ACCESS所有表的字段结构,含标题。
- 怎样列出Access所有的表名?
- oracle 脚本(3)-列出指定表的所有字段
- 怎样用sql列出一个表的所有字段或某一字段
- 删除一个表中所有含重复字段的数据
- asp阿获取access所有表的字段备注
- SQL Server 文档整理 - 1 列出目的表所有字段的存储过程
- mysql中列出所有表格的对应字段
- SQL Server默认值中的所有字段的列出
- 列出SQL SERVER数据库中所有表及字段信息
- 列出SQL SERVER数据库中所有表及字段信息
- Sqlserver列出所有数据库名,表名,字段名
- access模糊查询表所有字段
- 屏幕字段属性结构scrren里的字段含…
- 用php列出数据库的字段
- 列出MSSQL所有数据库名、所有表名、所有字段名
- 列出MSSQL所有数据库名、所有表名、所有字段名
- QLSERVER 列出所有用户表、列出所有表,字段名,主键,类型,长度,小数位数等信息
- c++内存管理
- 从获到拼音函数得到的一点心得体会
- SQL快捷方式
- 一种理想的大数据量分页查询方案
- 工作不要钱了-求职
- 用VFP列出ACCESS所有表的字段结构,含标题。
- 浅谈Hibernate中几种常用的主键生成策略
- 简单的SPT实例。
- 打算把几个引擎都给研究一下,丰富一下自己的业余生活!
- 使用Ext实现js的继承,以及扩展Ext组件的思路
- java与c#中面向对象的不同实现
- UML基础知识
- Automation for the people: Pushbutton documentation
- delphi 快捷键