Tuesday, March 17, 2009

Useful Functions in Classic ASP

1. Mid function to trim text for specific length
for 1 to 5 letter triming.
strtext=mid("text want to trim",1,5)

2. Replace function with Syntax
xyz=replace(Amit pal, " ", "G")

3. Find Server name by server variables
strServerURL = "http://" + Request.ServerVariables("SERVER_NAME")

4. Split Fuction Syntax
current_date=date
current_day=split(current_date,"/")

5. Trim function for trimimg blank spaces
email=trim(request.form("email"))

6. Count recordset's total number of rows for any Query's resultset

Method 1:

rs.open sqlQuery,ObjConn
rs.cursorlocation=3
Dim countRow
countRow=rs.Recordcount

Method 2:

rs.open sqlQuery,ObjConn,3
Dim countRow
countRow=rs.Recordcount

No comments: