jorkin / aspjson

Automatically exported from code.google.com/p/aspjson
0 stars 0 forks source link

Connection String Example #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Not a problem, but could you please provide an example of the connection 
string,

I have tried the following:

<%
'Dim dbconn
dbconn = "DSN=mydbname"
QueryToJSON(dbconn, "SELECT name, surname FROM login").Flush
%>

and

<%
'Dim dbconn
dbconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test.mdb;User 
Id=;Password=;"
QueryToJSON(dbconn, "SELECT name, surname FROM login").Flush
%>

Thanks

Original issue reported on code.google.com by s_s...@btinternet.com on 2 Jan 2009 at 2:35

GoogleCodeExporter commented 9 years ago
<%
Dim dbstr, dbconn
dbstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test.mdb;User 
Id=;Password=;"

Set dbconn = CreateObject("ADODB.Connection")
dbconn.Provider = dbstr
dbconn.Open

QueryToJSON(dbconn, "SELECT name, surname FROM login").Flush
%>

best regards

Original comment by tugrulto...@gmail.com on 3 Jan 2009 at 3:42

GoogleCodeExporter commented 9 years ago
Thanks for your example, cool!

I do have another question: Most examples require the format to be disaplyed as:

{"data": 
[{"header1": "something","header2": "something","header3": 
"something","header4": "so
mething","header4": "something","header5": 2}]}

i.e. the data outside the output is this something the script can do?

Original comment by s_s...@btinternet.com on 7 Jan 2009 at 1:24

GoogleCodeExporter commented 9 years ago

Dim od
Set od = jsObject()

Set od("data") = jsArray()
Set od("data")(Null) = jsObject()

od("data")(Null)("header1") = "something"
od("data")(Null)("header2") = "something"
od("data")(Null)("header3") = "something"
od("data")(Null)("header4") = "something"
od("data")(Null)("header5") = 2

od.Flush

Original comment by tugrulto...@gmail.com on 7 Jan 2009 at 2:35