C#²éѯÊý¾Ý¿â°Ñ½á¹ûÊä³öµ½XMLµÄÀý×Ó
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
//sqlserverÉí·ÝÑéÖ¤
//string sqlconn = "server=(local);database=keede1228;user id=sa;password=123;";
//windowsÉí·ÝÑéÖ¤
string sqlconn = "server=(local);database=keede1228;integrated security=SSPI;";
string select = "dirr4";
SqlConnection conn = new SqlConnection(sqlconn);
Console.WriteLine("33");
conn.Open();
Console.WriteLine("11");
//SqlCommand cmd = new SqlCommand(select, conn);
//SqlDataReader reader = cmd.ExecuteReader();
//while (reader.Read())
//{
// Console.WriteLine("cityid:{0} city:{1} area:{2}", reader[0], reader[1], reader[2]);
//}
SqlDataAdapter da = new SqlDataAdapter(select, conn);
DataSet ds = new DataSet();
da.Fill(ds, "custo");
foreach (DataRow row in ds.Tables["custo"].Rows)
Console.WriteLine("'{0}'from {1}", row[0], row[1]);
ds.WriteXml("write.xml", XmlWriteMode.WriteSchema);
conn.Close();
Console.WriteLine("22");
Console.ReadKey();
}
}
}
DataSetÀà̫ǿ´óÁË£¡
Ïà¹ØÎĵµ£º
//´ò¿ªÄ³Îļþ(¼ÙÉèweb.configÔÚ¸ùĿ¼ÖÐ)
string filename=Server.MapPath("/") + @"WebApplication1\web.config";
XmlDocument xmldoc= new XmlDocument();
xmldoc.Load(filename);
//µÃµ½¶¥²ã½ÚµãÁбí
......
ǰÑÔ
XMLÔ½À´Ô½ÈÈ£¬¹ØÓÚXMLµÄ»ù´¡½Ì³ÌÍøÂçÉ ......
package cn.com.xml.vo;
public class RosterVo {
private String id; //ѧºÅ
private String name; //ѧÉúÐÕÃû
private String age; //ÄêÁä
private String skill; //¿ÆÄ¿ ......
ʲôÊÇCache¶ÔÏó?
ÄãÔÚÉú³É¸ßÐÔÄÜÍøÂçÓ¦ÓóÌÐòʱËùÓöµ½µÄÒ»¸öÎÊÌâ¾ÍÊÇÐèÒª±ÜÃâÖØ¸´¡£Ò»¸öCache¶ÔÏóÔÊÐíÔÚËüÃǵÚÒ»´Î±»ÇëÇóʱÔÚÄÚ´æÖлº´æÏȻºó½«±»»º´æµÄ¸±±¾ÓÃÓÚÒÔºóµÄÇëÇó¡£Ê¹Óñ»»º´æµÄ¸±±¾ÔÊÐíÄã±ÜÃâÖØ½¨Âú×ãÒÔǰÇëÇóµÄÐÅÏ¢£¬ÌرðÊÇÄÇЩÿ´Î´´½¨Ê±¶¼ÐèÕ¼ÓÐÃ÷ʾµÄ·þÎñÆ÷ÉϵĴ¦ÀíÆ÷ʱ¼äµÄÃüÁî¡£
³ý»º´æ¸ö±ðÏÈç» ......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white" viewSourceURL="srcview/index.html">
<mx:S ......