-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathte_readDB_counter.asp
More file actions
92 lines (78 loc) · 2.51 KB
/
te_readDB_counter.asp
File metadata and controls
92 lines (78 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<%
'==============================================================
' TableEditoR 0.81 Beta
' http://www.2enetworx.com/dev/projects/tableeditor.asp
'--------------------------------------------------------------
' File: te_readDB_counter.asp
' Description: Generate CSV file giving total records in a table
' Initiated By Rami Kattan on Apr 22, 2002
'--------------------------------------------------------------
' Copyright (c) 2002, 2eNetWorX/dev.
'
' TableEditoR is distributed with General Public License.
' Any derivatives of this software must remain OpenSource and
' must be distributed at no charge.
' (See license.txt for additional information)
'
' See Credits.txt for the list of contributors.
'
' Change Log:
'--------------------------------------------------------------
'==============================================================
Response.ContentType = "text/csv"
' Get the requested number of records per page
%>
<!--#include file="te_config.asp"-->
<%
lConnID = request("cid")
sTableName = request("tablename")
sQuery = request("q")
'------------------------------
'added 8/10/01 by j.wilkinson, jwilkinson@mail.com
'added a check for nonAdmin users trying to view the admin table
'This is just checking that the connection ID = 0, assumes that
'non-admin users have no legitimate reason to get to that db at all.
' note that this may not protect against using queries to view
' this db and table
if lConnID=0 and not bAdmin then
response.end
end if
'------------------------------
const csvchar = ","
if sQuery <> "" then
bQuery = True
sTableName = replace(sTableName, """", "'")
end if
OpenRS arrConn(lConnID)
'Added by Danival
'Modified by Hakan
bProc = request.querystring("proc")
if instr(1, ucase(sTableName), "SELECT") then
sSQL = sTableName & sOrderBy
else
if bProc <> "" then
sParamString = request.querystring("paramstring")
sSQL = "EXEC [" & sTableName & "] " & sParamString
else
sSQL = "SELECT * FROM [" & sTableName & "]" & sWhere & sOrderBy
end if
end if
on error resume next
rs.CursorLocation = adUseServer
rs.Open sSQL, conn, adOpenStatic
if err <> 0 then
response.write "Error: " & err.description & "<br><br>"
if bQuery then
response.write "SQL: " & sSQL & "<br><br>"
end if
CloseRS
response.end
end if
on error goto 0
'Performance Issue:
'Getting the recordset properties may take long time for tables with many records
lRecs = rs.RecordCount
response.write "TotalRecords" & VbCrLf
response.write lRecs
CloseRS
%>