Web服务和放大器;传统的ASP

编程入门 行业动态 更新时间:2024-10-10 02:19:40
本文介绍了Web服务和放大器;传统的ASP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在工作中有一项任务,使用Web服务,使基于传统的ASP与放网站之间的沟通;基于Android平台的应用程序,创建一个带有参数的日期从屋宇署,我没有任何想法如何proceede,ü可以PLZ给我一个例子或TUTOS遵循提供数据的功能?

I have a task at work ,using web services , to make communication between a web site based on Classic Asp & an application based on android platform , to create function with a parameter Date which provide data from the bd,i dont have any idea how to proceede , can u plz give me an example or tutos to follow ?

推荐答案

您最简单的方法是产生JSON(它可以很容易地在Android端消耗)是这样的:

Your easiest option is to produce json (which can easily be consumed by the android side) like this:

ASP服务

<!-- this is one example of a library of json helpers that you can use. You can get it from this page www.webdevbros/2007/04/26/generate-json-from-asp-datatypes/ www.webdevbros/wp-content/uploads/2008/07/json151.zip save the downloaded json.asp file in the same folder as your .asp --> <!--#include file="json.asp" --> <% REM 1. Create and populate ADO Recordset from database REM Note: I am providing just an example and you might REM ant to look into using a more appropriate command type REM or cursor type when populating your recordset Set conn = Server.CreateObject("ADODB.Connection") conn.Open "put your connection string here" Set cmd = Server.CreateObject("ADODB.Command") cmd.CommandType = adCmdText 'note must have this constant defined in scope' Set cmdTemp.ActiveConnection = conn cmd.CommandText = "put your SQL here; be careful to protect against SQL injections" Set rs = Server.CreateObject("ADODB.Recordset") rs.Open cmd, ,adOpenForwardOnly,adLockReadOnly 'note make sure these constants are defined in scope' REM 2. Prepare json Dim jsonObject Set jsonObject = New JSON 'JSON class is in the include file json.asp' jsonResult = jsonObject.toJSON(Empty, rs, False) 'You may have to play with the parameters here, if the way json is formatted does not suit you' 'check the documentation of json.asp library' REM 3. stream json to client Response.ContentType = "application/json" Response.Write jsonResult %>

您可以找到更多的图书馆,帮助格式的值或结构成JSON:只需搜索传统的ASP+ JSON的SO或谷歌。 这里有一个图书馆这需要的VBScript / ASP结构,并将其输出的JSON。看SQL的例子。

You could find more libraries that help format values or structures into JSON: just search for "classic ASP" + JSON on SO or google. Here's one library that takes vbscript/ASP structures and outputs them in JSON. Look at the SQL example.

勾选此SO线程更多的经典的ASP和JSON

Check this SO thread for more "classic" ASP and JSON

更多推荐

Web服务和放大器;传统的ASP

本文发布于:2023-11-28 18:55:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643572.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:放大器   传统   Web   ASP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!