ToTem's BLOG

日拱一卒,功不唐捐

在ASP中定义SQLSERVER表

<%
'=============================
'在ASP中定义SQLSERVER表
'日期:2005-05-23
'作者:totem
'=============================
set adds=server.CreateObject("ADODB.connection")
    adds.Open conn,"",""
'事务开始
adds.begintrans
addsbf="if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EIS_XC_album]')

and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[EIS_XC_album]"
adds.EXECUTE(addsbf)

addscrt="CREATE TABLE [EIS_XC_album] ( " &_
 "[aid] [int] IDENTITY (1, 1) NOT NULL , " &_
 "[CnsId] [int] NOT NULL , " &_
 "[Title] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL , " &_
 "[Place] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL , " &_
 "[AlbmTime] [smalldatetime] NULL , " &_
 "[listphoto] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL , " &_
 "[photoheight] [int] NULL , " &_
 "[photowidth] [int] NULL , " &_
 "[Detail] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL , " &_
 "[CrtTime] [smalldatetime] NOT NULL , " &_
 "[CrtPsn] [int] NOT NULL , " &_
 "[xcdx] [int] NULL CONSTRAINT [DF_EIS_XC_album_xcdx] DEFAULT (0), " &_
 "[xps] [int] NULL CONSTRAINT [DF_EIS_XC_album_xps] DEFAULT (0) " &_
         ") ON [PRIMARY]"
adds.EXECUTE(addscrt)

addphotobf="if exists (select * from dbo.sysobjects where id =

object_id(N'[dbo].[EIS_XC_AbmPhotos]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table

[dbo].[EIS_XC_AbmPhotos]"
 adds.execute(addphotobf)

addphoto="CREATE TABLE [EIS_XC_AbmPhotos] (" &_
 "[id] [int] IDENTITY (1, 1) NOT NULL ," &_
 "[Aid] [int] NOT NULL ," &_
 "[cnsid] [int] NULL ," &_
 "[name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ," &_
 "[PhotoUrl] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ," &_
 "[PhotoDtl] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ," &_
 "[PhotoSize] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ," &_
 "[Photoheight] [int] NULL ," &_
 "[photowidth] [int] NULL ," &_
 "[photoslt] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ," &_
 "[CrtPsn] [int] NOT NULL ," &_
 "[CrtTime] [smalldatetime] NOT NULL " &_
        ") ON [PRIMARY]"
adds.execute(addphoto)
'事务结束
adds.committrans
adds.close
set adds=nothing
response.write "ok,the album has creating succeeded!!!"
%>

阅读更多
个人分类: ASP
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭