Asp Codes
ActiveX
ADO
Array
Code Snippets
Components
Data Access
Date Time
Files
Graphics
HTML Formatting
Mathematics
Miscellaneous
Sessions
SQL
Strings
Techniques
XML
Asp > Strings sample source codes
Recs Function
Recs Function <% 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 %>
Privacy Policy
|
Link to Us
|
Links