您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

用ADO建表ACCESS的表

2024/6/28 1:48:33发布31次查看
option explicit dim filename as string ' 创建数据库以及表和字段 private sub command1_click() dim mytable as tabledef dim myfield as field dim mydatabase as database set mydatabase = createdatabase(filename, dblanggeneral) ' 创建数据库 set m
option explicit
dim filename as string
' 创建数据库以及表和字段
private sub command1_click()
dim mytable as tabledef
dim myfield as field
dim mydatabase as database
set mydatabase = createdatabase(filename, dblanggeneral) ' 创建数据库
set mytable = mydatabase.createtabledef(text2.text) ' 创建表
set myfield = mytable.createfield(text3.text, dbtext, 50) ' 创建字段
mytable.fields.append myfield ' 将新创建的字段添加到表中
mydatabase.tabledefs.append mytable ' 将表添加到数据库中
' 重复创建多个表和字段并添加到数据库中
set mytable = mydatabase.createtabledef(text4.text)
set myfield = mytable.createfield(text5.text, dbtext, 50)
mytable.fields.append myfield
set myfield = mytable.createfield(text6.text, dbtext, 50)
mytable.fields.append myfield
mydatabase.tabledefs.append mytable
msgbox 完成创建数据库 + filename
end sub
' 设置创建的数据库的位置和名称
private sub command2_click()
' 设置对话框
with commondialog1
.cancelerror = true
.filter = 数据库(*.mdb)|*.mdb
.flags = cdlofnhidereadonly
.showsave
if err.number = cdlcancel then
err.clear
exit sub
end if
filename = .filename
text1.text = .filetitle
end with
end sub
' 退出程序
private sub command3_click()
end
end sub
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product