first commit
This commit is contained in:
29
Lib/JSON_UTIL_0.1.1.asp
Normal file
29
Lib/JSON_UTIL_0.1.1.asp
Normal file
@@ -0,0 +1,29 @@
|
||||
<%
|
||||
Function QueryToJSON(dbc, sql)
|
||||
Dim rs, jsa
|
||||
Set rs = dbc.Execute(sql)
|
||||
Set jsa = jsArray()
|
||||
While Not (rs.EOF Or rs.BOF)
|
||||
Set jsa(Null) = jsObject()
|
||||
For Each col In rs.Fields
|
||||
jsa(Null)(col.Name) = col.Value
|
||||
Next
|
||||
rs.MoveNext
|
||||
Wend
|
||||
Set QueryToJSON = jsa
|
||||
End Function
|
||||
|
||||
Function RecordsetToJSON(ByVal rs)
|
||||
Dim jsa,col
|
||||
Set jsa = jsArray()
|
||||
While Not (rs.EOF Or rs.BOF)
|
||||
Set jsa(Null) = jsObject()
|
||||
For Each col In rs.Fields
|
||||
jsa(Null)(col.Name) = col.Value
|
||||
Next
|
||||
rs.MoveNext
|
||||
Wend
|
||||
Set RecordsetToJSON = jsa
|
||||
End Function
|
||||
|
||||
%>
|
||||
Reference in New Issue
Block a user