<!--#include file="../Inc/Function.asp"-->
<%
OpenDBConn
sql = "select * from dbo.sysobjects where id = object_id(N'[dbo].[TuiGuang]') and OBJECTPROPERTY(id, N'IsUserTable') = 1"
createRs
rs.open sql,conn,1,1
if rs.eof or rs.bof then
'创建TuiGuang(网站推广表)
sql ="create table [dbo].[TuiGuang]("&_
"[id][int] identity (1,1) not null,"&_ 'id标识
"[TName][varchar](100) collate chinese_prc_ci_as null,"&_ '名称
"[Content][ntext] collate chinese_prc_ci_as null,"&_ '产品描述
"[pic][varchar](100) collate chinese_prc_ci_as null,"&_ '图片
"[price][int] null,"&_ '价格
"constraint [pk_TuiGuang] primary key clustered("&_
"[id]"&_
")on [primary]"&_
")on [primary]"&_
rs.close
conn.execute(sql)
response.write "创建TuiGuang表成功<br>"
else
response.write "已存在"
rs.close
end if
Set rs = Nothing
CloseDBConn
%>

博客内容主要展示了使用ASP和SQL创建TuiGuang表的代码。先查询该表是否存在,若不存在则执行创建表的SQL语句,包含表结构定义,如id、名称、描述等字段;若存在则提示已存在。
1679

被折叠的 条评论
为什么被折叠?



