. Net flip Control

Source: Internet
Author: User
. Net flip Control
// Retrieve the total number of records
Create procedure DBO. yourcompany_ywkj_pagegetcount
@ Tabname nvarchar (50 ),
@ Colname nvarchar (50 ),
@ ID int
As
Exec ('select count (*) as num from '+ @ tabname + 'where' + @ colname +' = '+ @ ID)
Go
// Page flip

Create procedure yourcompany_ywkj_meaagereplyfortopicid
@ Topicid int,
@ Indent int,
@ Startindex int,
@ Endindex int
As
If (@ indent = 1)
Begin

Set nocount on
Declare @ indextable table (ID int identity (1, 1), nid int)
Set rowcount @ endindex
Insert into @ indextable (NID) Select messageid from message where topicid = @ topicid order by messageid
Select M. messageid, M. topicid, U. username, M. messagecontent, M. messagecreatetime
From message m, users U, @ indextable t where M. topicid = @ topicid and M. messageuserid = U. userid
And M. messageid = T. Nid
And T. ID between @ startindex and @ endindex order by T. ID
Set nocount off

End
Else -- Obtain the msgid of this topic
Begin
Select messageid

From message

Where topicid = @ topicid and indent = 0
End
Go

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.