用asp整理磁盘文件
机器的文件太多,需要整理一下,该如何做呢?????本文以整理图片文件为例,给大家一点思路
代码的运行环境:iis5.0+sql server2000
数据库脚本:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[insertpic]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[insertpic]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[showpage]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[showpage]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[picpath]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[picpath]
GO
CREATE TABLE [dbo].[picpath] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[path] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
--作用:插入记录
CREATE PROCEDURE [insertpic]
(
--路径--
@path varchar(100)
)
AS
insert picpath(path) values(@path)
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/*
'# 过程:showpage
'# 描述:用来记录集分页
'# 参数: - pagenum (页码)
'# 返回:-两个记录集,第一个记录集包含两个字段(总页数),第二个记录集为数据库返回给程序要显示的数据
'# 作者:zhengs
'# 日期:2002-08-27
*/
CREATE PROCEDURE showpage
----页码
@PageNum int
AS
SET NOCOUNT ON
declare
@pagecount int,
@iFrom int,
@iRowCount int,
@dpicid int
----计算该页起始的偏移量
if @PageNum <= 0
set @PageNum = 1
set @iFrom = 10 * (@PageNum - 1) + 1
----判断传入的页码是否有效
select @iRowCount = count(id) from picpath ----取得图片数
set @PageCount = @iRowCount / 10 ----计算图片页数
if @iRowCount %10> 0
set @PageCount = @PageCount + 1
补充:asp教程,高级应用