用SQL语句创建和删除Access数据库中的表;添加列和删除列

penper 2002-05-07 04:30:39
最好各种方法都有,谢谢!
...全文
283 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
footballboy 2002-05-07
  • 打赏
  • 举报
回复
Dim conn As New ADODB.Connection
conn.open "dsn=aaa;"
conn.Execute "create table tbName(column1 text,column2 integer)"

您有多处拼写错误
conection-->Connection
excute-->Execute
creat-->create
用双引号
penper 2002-05-07
  • 打赏
  • 举报
回复
dim conn as new adodb.conection
conn.open "dsn=aaa;"
conn.excute(creat table tbName (column1 text,column2 integer))

但是运行出错,为什么?
liuyufeng 2002-05-07
  • 打赏
  • 举报
回复
建立数据表
create table 数据表名称(字段名称1 数据类型1(数据长度),字段名称2 数据类型2(数据长度),...)

删除数据表
drop table 数据表名称

编辑数据表
添加字段
alter table 数据表名称 add 字段名称 数据类型(数据长度)

删除字段
alter table 数据表名称 drop 字段名称

footballboy 2002-05-07
  • 打赏
  • 举报
回复
建立数据表
create table 数据表名称(字段名称1 数据类型1(数据长度),字段名称2 数据类型2(数据长度),...)

删除数据表
drop table 数据表名称

编辑数据表
添加字段
alter table 数据表名称 add 字段名称 数据类型(数据长度)

删除字段
alter table 数据表名称 drop 字段名称

字段更名
没有直接的更名语句,但可以用先删再除添加的方法实现

gump2000 2002-05-07
  • 打赏
  • 举报
回复
SQL语句,具体使用方法请看帮助

Create Table tab1 (fld1 integer)
Drop Table tab1

Alter Table tab1 Add COLUMN col1 integer
Alter Table tab1 Drop COLUMN col1

1,217

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧