asp.net ²Ù×÷xmlÎļþ
using System.Xml;//Í·²¿¼Ó´ËÃüÃû¿Õ¼ä
XmlDocument xd = new XmlDocument();//±íʾXMLÎĵµ
XmlDeclaration xde;//±íʾ XML ÉùÃ÷½Úµã£º<?xml version='1.0'...?>
xde = xd.CreateXmlDeclaration("1.0", "GBK", null);//²ÎÊýµÄµÚ¶þÏîΪ±àÂ뷽ʽ
//standalone¶¨ÒåÁËÊÇ·ñ¿ÉÒÔÔÚ²»¶ÁÈ¡ÈκÎÆäËüÎļþµÄÇé¿öÏ´¦Àí¸ÃÎĵµ,ĬÈÏΪno
xd.AppendChild(xde);//<?xml version="1.0" encoding="UTF-8" standalone="yes"?>Éú³É½áÊø
XmlElement xe = xd.CreateElement("Root");//´´½¨Ò»¸öRoot¸ùÔªËØ
xd.AppendChild(xe);//Root¸ùÔªËØ´´½¨Íê³É
XmlNode root = xd.SelectSingleNode("Root");//²éÕÒ<Root>
XmlElement xe1 = xd.CreateElement("Tree");//ÔÚ<Root>֮ϴ´½¨ÔªËØ<Tree>
xe1.SetAttribute("id","1");//Ö¸¶¨ÊôÐÔµÄÊôÐÔÖµ
xe1.InnerText = "ÀàÐÍ1";//Ö¸¶¨ÊôÐÔÎı¾½Úµã
root.AppendChild(xe1);//Íê³É×Ó½Úµã<Tree>
xd.Save(Server.MapPath("xml.xml"));
ÏÂÃæµÄÄÚÈÝÎÒÔÝʱûÓÐʹÓõ½: ÓÐһЩ´íÎó,¶¼ÊÇË«ÒýºÅµÄÎÊÌâ,ÓеÄÐèÒªÔÚÃû³ÆÁ½±ß¼ÓË«ÒýºÅ²ÅÄÜÕý³£Ê¹ÓÃ.
ÒÑÖªÓÐÒ»¸öXMLÎļþ£¨bookstore.xml£©ÈçÏ£º
<?xml version=1.0 encoding=gb2312?>
<bookstore>
<book genre=fantasy ISBN=2-3631-4>
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price>
</book>
</bookstore>
1¡¢Íù<bookstore>½ÚµãÖвåÈëÒ»¸ö<book>½Úµã£º
XmlDocument xmlDoc=new XmlDocument();
xmlDoc.Load(bookstore.xm
Ïà¹ØÎĵµ£º
±êÇ©£ºÊý¾Ý·ÃÎÊ LINQ to XML
LINQ to XML²¢²»´òËãÌæ´ú±ê×¼µÄXML API£¬Ö»ÊDz¹³äÁËÕâЩ±ê×¼XMLÀà ......
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
namespace System.Bwch.XmlConfig
{
/**////
/// ¶ÁÈ¡XMLÅäÖÃÎļþÀà
///
public class XmlHelper
{
private string strXmlPath = ""; //XmlÎĵµÂ·¾¶
private XmlDocument xmlD ......
ͨ¹ý SqlDataSource ¿Ø¼þ£¬¿ÉÒÔʹÓà Web ·þÎñÆ÷¿Ø¼þ·ÃÎÊλÓÚ¹ØϵÊý¾Ý¿âÖеÄÊý¾Ý¡£ÆäÖпÉÒÔ°üÀ¨ Microsoft SQL Server ºÍ Oracle Êý¾Ý¿âÒÔ¼° OLE DB ºÍ ODBC Êý¾ÝÔ´¡£Äú¿ÉÒÔ½« SqlDataSource ¿Ø¼þÓëÊý¾Ý°ó¶¨¿Ø¼þ£¨Èç GridView¡¢FormView ºÍ DetailsView ¿Ø¼þ£©Ò»ÆðʹÓã¬Óü«ÉÙ´úÂë»òÉõÖÁ² ......
ͨ³££¬SQL Óï¾äºÍ´æ´¢¹ý³Ì°üÀ¨ÔËÐÐʱ¼ÆËãµÄ²ÎÊý¡£Ê¹ÓòÎÊý±àдµÄ SQL Óï¾ä³Æ×÷²ÎÊý»¯ SQL Óï¾ä¡£
ʹÓà SqlDataSource ¿Ø¼þʱ£¬¿ÉÒÔÖ¸¶¨Ê¹ÓòÎÊýµÄ SQL ²éѯºÍÓï¾ä¡£Í¨¹ý¸ù¾ÝÔËÐÐʱ¼ÆËãµÄÖµ¶ÁдÊý¾Ý¿âÐÅÏ¢£¬ÕâÓÐÖúÓÚÌáÉýÊý¾Ý°ó¶¨»·¾³µÄÁé»îÐÔ¡£¿ÉÒÔ´Ó¸÷ÖÖÔ´»ñÈ¡²ÎÊýÖµ¡£ÕâЩԴ°üÀ¨ ASP.N ......
ʹÓà SqlDataSource ¿Ø¼þÖ»ÐèºÜÉٵĴúÂë»òÎÞÐèÈκδúÂë¼´¿É´ÓÊý¾Ý¿âÖмìË÷Êý¾Ý¡£SqlDataSource ¿Ø¼þ¿ÉÓÃÓÚÈκξßÓйØÁª ADO.NET Ìṩ³ÌÐò£¨ÔÚÅäÖÃÎļþµÄ DbProviderFactories ½ÚÖÐÅäÖ㩵ÄÊý¾Ý¿â£¬°üÀ¨ Microsoft SQL Server¡¢Oracle¡¢ODBC »ò OLE DB Êý¾Ý¿â£¨Èç Microsoft Access£©¡£ÄúÔÚÅäÖÃʱָ¶¨ SqlDataSource ʹÓõ ......