Use asp to organize disk files

Source: Internet
Author: User
There are too many files on the machine. You need to sort them out. What should you do ?????
This article takes Image file sorting as an example to give you some ideas.
Code running environment: iis5.0 + SQL server2000
Database script:
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
-- Function: insert a record
Create procedure [insertpic]
(
-- Path --
@ 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
/*
'# Process: showpage
'# Description: used to record set paging
'# Parameter:-pagenum (page number)
'# Return:-two record sets. The first record set contains two fields (total number of pages), and the second record set is the data that the database returns to the program for display.
'# Author: zhengs
'# Date: 2002-08-27
*/
Create procedure showpage
---- Page number
@ PageNum int
AS
SET NOCOUNT ON
Declare
@ Pagecount int,
@ IFrom int,
@ IRowCount int,
@ Dpicid int
---- Calculate the start offset of the page
If @ PageNum <= 0
Set @ PageNum = 1
Set @ iFrom = 10 * (@ PageNum-1) + 1
---- Determine whether the incoming page number is valid
Select @ iRowCount = count (id) from picpath ---- get the number of images
Set @ PageCount = @ iRowCount/10 ---- calculate the number of image pages
If @ iRowCount % 10> 0
Set @ PageCount = @ PageCount + 1
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.