<%
Function QueryToJSON(sql)
        Dim rs, jsa
        'Set rs = dbc.Execute(sql)
        Set rs = DBExec(sql, "study")
        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 QueryToJSONByDBTarget(sql, DBTarget)
  Dim rs, jsa
        'Set rs = dbc.Execute(sql)
  Set rs = DBExec(sql, DBTarget)

        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 QueryToJSONByDBTarget = jsa
End Function

%>

Posted by kunoo
,