附:
1.以上全体代码在Windows2000ServerSP2+IIS5.0+MSSQLServer2000+Office2000下测试经由过程
2.设置数据库:数据库名course,用户course_user,暗码course_password,ODBC驱动为course_dsn,端口为2433,形貌表布局的剧本在共享目次下。
3.Aspfileup、Jmail、Winzip8.1、Winzipcommandline这几个软件请自行下载。
4.数据库剧本文件:
ifexists(select*fromdbo.sysobjectswhereid=object_id(N[dbo].[output_1])andOBJECTPROPERTY(id,NIsProcedure)=1)
dropprocedure[dbo].[output_1]
GO
ifexists(select*fromdbo.sysobjectswhereid=object_id(N[dbo].[return_1])andOBJECTPROPERTY(id,NIsProcedure)=1)
dropprocedure[dbo].[return_1]
GO
ifexists(select*fromdbo.sysobjectswhereid=object_id(N[dbo].[user_info_1])andOBJECTPROPERTY(id,NIsProcedure)=1)
dropprocedure[dbo].[user_info_1]
GO
ifexists(select*fromdbo.sysobjectswhereid=object_id(N[dbo].[user_info_2])andOBJECTPROPERTY(id,NIsProcedure)=1)
dropprocedure[dbo].[user_info_2]
GO
ifexists(select*fromdbo.sysobjectswhereid=object_id(N[dbo].[user_info_3])andOBJECTPROPERTY(id,NIsProcedure)=1)
dropprocedure[dbo].[user_info_3]
GO
ifexists(select*fromdbo.sysobjectswhereid=object_id(N[dbo].[user_info])andOBJECTPROPERTY(id,NIsUserTable)=1)
droptable[dbo].[user_info]
GO
CREATETABLE[dbo].[user_info](
[id][int]IDENTITY(1,1)NOTNULL,
[user_name][varchar](40)COLLATEChinese_PRC_CI_ASNOTNULL,
[password][varchar](20)COLLATEChinese_PRC_CI_ASNOTNULL
)ON[PRIMARY]
GO
ALTERTABLE[dbo].[user_info]WITHNOCHECKADD
CONSTRAINT[PK_user_info]PRIMARYKEYCLUSTERED
(
[user_name]
)ON[PRIMARY]
GO
SETQUOTED_IDENTIFIEROFF
GO
SETANSI_NULLSOFF
GO
CREATEPROCEDURE[output_1]
@sidintoutput
AS
set@sid=2
GO
SETQUOTED_IDENTIFIEROFF
GO
SETANSI_NULLSON
GO
SETQUOTED_IDENTIFIEROFF
GO
SETANSI_NULLSOFF
GO
CREATEPROCEDURE[return_1]
(@user_namevarchar(40),@passwordvarchar(20))
AS
ifexists(selectidfromuser_infowhereuser_name=@user_nameandpassword=@password)
return1
else
return0
GO
SETQUOTED_IDENTIFIEROFF
GO
SETANSI_NULLSON
GO
SETQUOTED_IDENTIFIERON
GO
SETANSI_NULLSOFF
GO
CREATEPROCEDURE[user_info_1]
(@user_namevarchar(40),@passwordvarchar(20))
AS
selectidfromuser_infowhereuser_name=@user_nameandpassword=@password
GO
SETQUOTED_IDENTIFIEROFF
GO
SETANSI_NULLSON
GO
SETQUOTED_IDENTIFIEROFF
GO
SETANSI_NULLSOFF
GO
CREATEPROCEDURE[user_info_2]
(@user_namevarchar(40),@passwordvarchar(20))
AS
SETXACT_ABORTON
BEGINTRANSACTION
deletefromuser_infowhereuser_name=@user_nameandpassword=@password
COMMITTRANSACTION
SETXACT_ABORTOFF
GO
SETQUOTED_IDENTIFIEROFF
GO
SETANSI_NULLSON
GO
SETQUOTED_IDENTIFIEROFF
GO
SETANSI_NULLSOFF
GO
CREATEPROCEDURE[user_info_3]AS
select*fromuser_info
GO
SETQUOTED_IDENTIFIEROFF
GO
SETANSI_NULLSON
GO