将 mdb.asp 放在你的站点。
从建库到建表,以及增、删、改、查询数据等都可在该软件下进行。
运行时会自动遍历站点各目录下的的Access数据库文件(*.mdb),供操作选择。
程序可切换不同的数据库,切换不同的连接字符串,显示库中的所有表,可显示表的前5条信息,可用鼠标拖拽选择要执行的命令,然后再执行,是学习ASP进行Access数据库操作的最佳助手。
------------------------------------------------------------------------------------------
一些命令参考:
create database db.mdb // 创建数据库,新建的库里面没有表,需创建表,如下:
drop table abc // 删除表
create table abc(
name varchar(10) not null unique, // 字符型,10个宽度,不能为空,唯一
a identity(1,2) primary key, // 自动编号,从1开始,每次增2,主键
b bit default true, // 逻辑性,默认为true
i1 byte, // 字节数值
i2 short, // 整型数值
i3 int default 18, // 长整型,默认18
i4 long, // 目前也是长整型
f1 single, // 单精度
f2 double, // 双精度
d1 date, // 日期型
d2 time, // 同上
d3 datetime default now, // 同上,默认值:now()
t1 varchar(10),
t2 varchar(10),
t3 text, // 备注型
m memo, // 同上
constraint my_chk check (i3>18 and i3<23 and i4>100), // check约束
constraint my_uni unique (t1,t2) // unique约束
)
alter table abc alter column m money // 修改表字段成货币型
alter table abc add new varchar(10) default 'ok' // 添加新字段
alter table abc drop constraint my_chk // 删除check约束
alter table abc drop constraint my_uni // 删除unique约束
alter table abc drop column i4,d1,d2,t2 // 删除表字段
alter table abc add constraint my_chk check(i3>18 and i3<24)// 添加check约束
alter table abc add check(i1<20 and d3<#2010-10-1#) // 无名的涉及多个字段的约束
---------------------------------------------------------------
http://www.makechm.com/chmbook/1150/1152.html
create table a(id identity(1,1) primary key,name varchar(10))
create table b(id identity(1,1) primary key, bh int, foreign key (bh) references a(id) )
- 1
- 2
- 3
前往页