在asp使用ado创建access数据表

示例代码:


db="db1.mdb"
set conn=server.CreateObject("adodb.connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
sql="CREATE TABLE [news] ("&_
 "[news_id] COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,"&_
 "[news_title] text(225),"&_
 "[news_type] integer DEFAULT 0,"&_
 "[news_index] integer DEFAULT 0,"&_
 "[news_date] datetime DEFAULT now(),"&_
 "[news_content] memo,"&_
 "[news_pic] text(255),"&_
 "[news_fujian] text(255),"&_
 "[depart_id] integer DEFAULT 0,"&_
 "[news_author] text(50),"&_
 "[news_checkname] text(50),"&_
 "[news_check] integer DEFAULT 1,"&_
 "[news_order] integer DEFAULT 0,"&_
 "[newsclass_id] integer DEFAULT 0,"&_
 "[news_link] text(50),"&_
 "[news_hit] integer DEFAULT 0,"&_
 "[news_english] integer DEFAULT 0,"&_
 "[pclass_id] integer DEFAULT 0,"&_
 "[news_over] integer DEFAULT 0,"&_
 "[news_isnew] integer DEFAULT 0,"&_
 "[news_zwlx] text(50) )"
conn.execute sql

 说明:
COUNTER CONSTRAINT PrimaryKey PRIMARY KEY 创建自动编号并设为主键;
DEFAULT 为字段设置默认值
常用字段类型:
text:文本
integer:整型
datetime:日期/时间
memo:备注
boolean:是/否

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值