A few days ago, after sending this control, many friends reported that there was no data source. Sorry. I am a bit empty today to post the data and a related paging stored procedure. If you need it, you can download it here:
-- Create an example table
If exists (select * From DBO. sysobjects where id = object_id (n' [subjects] ') and objectproperty (ID, n'isusertable') = 1)
Drop table [subjects]
Go
Create Table [subjects] (
[ID] [smallint] identity (1, 1) not null,
[Subjectname] [varchar] (100) Collate chinese_prc_ci_as not null,
[Cncode] [varchar] (20) Collate chinese_prc_ci_as null,
[Subjectcode] [char] (20) Collate chinese_prc_ci_as not null,
[Isend] [bit] Null,
Constraint [pk_subjects] primary key clustered
(
[ID]
) On [primary]
) On [primary]
Go
-- Data
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (1, 'Vat ', 'zzs ', '01', 0)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (2, 'domestic VAT ', 'gnzzs ', '123', 0)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (3, 'state-owned enterprise VAT ', 'gyqyzzs ', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (4, 'collectively-owned enterprise VAT ', 'jtqyzzs ', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (5, 'joint-stock enterprise VAT ', 'gfzqyzzs ', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (6, 'joint venture VAT ', 'lyqyzzs ', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (7, 'value-added tax for Hong Kong and Macao Taiwan and foreign-invested enterprises ', 'gathwstzqyzzs', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (8, 'Private enterprise VAT ', 'syqyzzs ', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (9, 'other VAT ', 'qtzzs ', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (10, 'value-added tax late payment, fine income ', 'zzsskznj, fksr', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (11, 'Vat rebates for welfare enterprises ', 'flqyzzsts ', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (12, 'value-added tax rebates for Software Integrated Circuit ', 'composer jcdlzzsts', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (13, 'tax refund for three-line relocation VAT rebates ', 'sxbqzzsts ', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (14, 'value-added tax rebates for domestic and commercial enterprises ', 'mmqyzzsts ', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (15, 'value-added tax rebates for promotional cultural organizations ', 'xcwhdwzzsts', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) Values ', 'sgzhlyzzsts', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (17, 'other VAT rebates ', 'qtzzsts ', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (18, 'value-added-without-offset VAT ', 'mddzzzs ', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (19, 'import goods VAT ', 'jkhwzzs ', '123', 0)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (20, 'value-added tax for imported goods ', 'jkhwzzs ', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (21, 'value-added for personal materials imported in a specific region ', 'tdqyjkzywzzzs', '20170101', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) Values ', 'jkhwzzsskznj, fksr', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (23, 'value-added tax for imported goods return ', 'jkhwtzzs ', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (24, 'Vat for imported materials for personal use in a specific region ', 'tdqyjkzywztzzs', '20170101', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (25, 'export goods return VAT ', 'ckhwtzzs ', '123', 0)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (26, 'export goods return VAT ', 'ckhwtzzs ', '123', 1)
Insert [subjects] ([ID], [subjectname], [cncode], [subjectcode], [isend]) values (27, 'value-for-VAT exemption ', 'mddjzzs ', '123', 1)
-- Paging Stored Procedure
Set quoted_identifier on
Go
Set ansi_nulls on
Go
If exists (select * From DBO. sysobjects where id = object_id (n' [msp_page] ') and objectproperty (ID, n' isprocedure') = 1)
Drop procedure msp_page
Go
/*************************************** **************************
* Function Description: Paging query results
**************************************** **************************
*/
Create procedure msp_page
(
@ SQL text = 'select 1 ',
@ Pageindex Int = 0, -- page index
@ Pagesize Int = 100, -- page record
@ Rowcount int output, -- total records
@ Pagecount int output -- total number of pages
)
As
Set nocount on
Declare @ P1 int
Set @ pagecount = (@ pageindex) * @ pagesize + 1 -- page number starts from 0
Exec sp_cursoropen @ P1 output, @ SQL, @ scroalopt = 1, @ ccopt = 1, @ rowcount = @ rowcount output
Exec sp_cursorfetch @ P1, 16, @ pagecount, @ pagesize
Exec sp_cursorclose @ p1
If (@ rowcount % @ pagesize <> 0)
Begin
Set @ pagecount = (@ rowcount/@ pagesize) + 1
End
Else
Begin
Set @ pagecount = (@ rowcount/@ pagesize)
End
Select @ rowcount, @ pagecount
Return
Go
Set quoted_identifier off
Go
Set ansi_nulls on
Go