mySQL/json/asp

jegadk

Member
Licensed User
Longtime User
Hi

Need help to read mysql db with json and asp page. Looked at the sample from Erel, but in php.

I have made a little test app, that works fine with Erel's php script, but when i use my own asp code, there never comes a http ResponseSuccess back. I can only see that it is my asp page that not responses correct....

From app i call:
ExecuteRemoteQuery("SELECT id, name FROM person WHERE name like '%jesper%' ORDER BY name",1)
req.InitializePost2("http://xxx.xxx.xxx.xxx:1006/ws1.asp?", Query.GetBytes("UTF8"))

ws1.asp
<!-- #include file="db_inc.asp" -->
<!--#include file="JSON_2.0.4.asp"-->
<!--#include file="JSON_UTIL_0.1.1.asp"-->

<%
response.ContentType = "application/jsonrequest; charset=utf-8"

QueryToJSON(myConn, replace(request.querystring,"%20"," ")).Flush
%>


Anyone that can help ????

Jesper
 

vb1992

Well-Known Member
Licensed User
Longtime User
also remember you need to initialize first
this is for sending an image, but you get the idea


HttpClient1.Initialize("HttpClient1")
Dim req As HttpRequest
Dim size As Long
ProgressDialogShow("Sending 700k to Server...")
req.InitializePost2("http://xxxxxxxxxxxxxxx/abc.asp", Data)
HttpClient1.Execute(req, 1)
 
Last edited:
Upvote 0

jegadk

Member
Licensed User
Longtime User
AHHHH

Just saw the light....

Was reading the Query.GetBytes("UTF8") as request.querystring, just needed jo read it as request.form

This code works

countries.asp

<%
Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open "Driver={MySQL ODBC 5.1 Driver};Server=servername;Port=3306;Database=dbname;User=username; Password=password;Option=3;"

%>
<!--#include file="JSON_2.0.4.asp"-->
<!--#include file="JSON_UTIL_0.1.1.asp"-->
<%
response.ContentType = "application/json; charset=utf-8"
response.write QueryToJSON(myConn,request.form).flush

%>

json files can be downloaded from json.org
 
Upvote 0

jegadk

Member
Licensed User
Longtime User
Thisa IS the whole code of countries.asp

Rest is the sample from Erel, just using an asp instead of php...
 
Upvote 0
Top