[英]how to send xml file to android application using c#
我想将数据从c#(aspx)发送到android应用程序。
我的c#(aspx)页面具有从android应用程序调用的代码,该代码从sql数据库检索值,然后使用DataSet将其放入XML文件,然后将xml文件返回给android应用程序。
用于从数据库检索数据并将其存储在xml中的代码如下:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using System.IO;
class ExecuteXmlReader
{
public static void Main()
{
String sConnection = "server=.\\SQLExpress;Integrated Security=SSPI;database=employee";
SqlConnection mySqlConnection = new SqlConnection(sConnection);
mySqlConnection.Open();
// Get the same data through the provider.
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter("SELECT FirstName,LastName,Title,City from employees", sConnection);
DataSet myDataSet2 = new DataSet();myDataSet2.DataSetName = "Region";
mySqlDataAdapter.Fill(myDataSet2);
// Write data to files: data1.xml and data2.xml for comparison.
myDataSet2.WriteXml("c:/temp/employees.xml");
mySqlConnection.Close();
}
}
现在如何将这个xml文件返回给android应用程序。 在android中,我使用DOM XML parser
从文件中提取数据。
请帮助我。任何技巧都可以接受。
使用具有这种消费有样品WCF Web服务在android- http://fszlin.dymetis.com/post/2010/05/10/Comsuming-WCF-Services-With-Android.aspx.hope这可以帮助您
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.