123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home

Source Codes

Engineering Colleges

BE Students

Training  Reports (updated)

Seminar Reports (updated

Placement Papers (updated)

Forums

   Computer Science / IT

   Electronics

   Electrical

   Mechanical

   Chemical

   Civil

   CAT / MBA

   GMAT / Foreign MBA

Latest Jobs

Engineering Jobs / Technical Jobs

Management Jobs

Sitemap

About-Us

Terms of use

Displaying  Source Code(s)  
 

 
Recs Function

--------------------------------------------------------------------------------

Description : The Recs function returns a long representing the record count returned by an SQL statement. There are two required arguments: ConnString and SQL. ConnString must be set to a valid database connection string and SQL must be set to a valid SQL statement. Recs returns Null if error handling is enabled and a problem is encountered while obtaining a record count.

<%
Private Function Recs(ByVal connstring, ByVal sql)
Const adOpenStatic = 3, adLockReadOnly = 1, adCmdText = &H0001
Dim objCn, bErr1, bErr2, strErrDesc, objRs
On Error Resume Next
Set objCn = Server.CreateObject("ADODB.Connection")
objCn.Open ConnString
If Err Then
bErr1 = True
Else
Set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open sql, objCn, _
adOpenStatic, adLockReadOnly, adCmdText
If objRs.BOF Then
Recs = 0
Else
Recs = CLng( objRs.RecordCount )
End If
objRs.Close
Set objRs = Nothing
If Err Then
bErr2 = True
strErrDesc = Err.description
End If
End If
objCn.Close
Set objCn = Nothing
On Error GoTo 0
If bErr1 Then
Err.Raise 5109, "Recs Function", "Bad connection " & _
"string. Database cannot be accessed."
Recs = Null
ElseIf bErr2 Then
Err.Raise 5109, "Recs Function", strErrDesc
Recs = Null
End If
End Function
%>

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved copyright 123ENG