ASP implements a function to obtain the specified criteria row number for the MSSQL database table

Source: Internet
Author: User
Tags mssql table name

This article mainly introduces the ASP to obtain the database table to specify the criteria for the number of functions of the function of the relevant data, need friends can refer to the

The code is as follows:
' Database table row number function, which is the number of rows to fetch the table
Function gettblrows (tblname)
' If the Tblname table name value is empty, the
If Tblname= "" Then
Gettblrows= "Unknown Tblname"
Exit Function
Else
Set rec = Server.CreateObject ("Adodb.recordset")
Sql= "EXEC sp_spaceused" &tblname
Rec.open sql,conn,1,1
Gettblrows=trim (Rec ("Rows"))
Rec.close
Set rec=nothing
End If
End Function

How to use it?

The code is as follows:
<%=gettblrows ("table name")%>

The above is the full content of this article, I hope you can enjoy.

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.