在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:是/否

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页