C# ²Ù×÷XML£¬×Ô¼ºÓùýµÄ´úÂ룬¿ÉÄÜÖ»ÓÐÎÒÄÜ¿´¶®
public string WriteXML(string[] values, int flag)
{
//Èç¹ûflag==0ÔòΪµÚÒ»´ÎÔËÐÐÐèÒª³õʼ»¯XMLÎļþ
if (flag == 0)
{
//ÉúÔÚËæ»úÎļþÃû
string dateName = System.DateTime.Now.ToString("yyyyMMddHHmmss");
string newFileName = Session["orgid"].ToString() + "_" + Session["DeptID"].ToString() + "_" + Session["UserID"].ToString() + "_" + dateName;
string PersonalFolder = Server.MapPath(@"~/offline/" + Session["OrgID"].ToString() + "_" + Session["DeptID"].ToString() + "_" + Session["UserID"].ToString() + "/" + DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss"));
if (!Directory.Exists(PersonalFolder))
{
Directory.CreateDirectory(PersonalFolder);
}
//Directory.SetAccessControl(PersonalFolder, System.Security.AccessControl.DirectorySecurity);
string file = PersonalFolder + "\\" + newFileName + ".xml";
Session["PersonalFolder"] = PersonalFolder;
Session["file"] = file;
#region ´´½¨Îļþ
StreamWriter sw = File.CreateText(file);
sw.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
sw.WriteLine("<ChkQuaran UserID=\"\" UserName=\"\" DeptID=\"\" OrgID=\"\" RoleID=\"\">");
//sw.WriteLine("<ChkInfo>");
sw.WriteLine();
//sw.WriteLine("</ChkInfo>");
sw.WriteLine("</ChkQuaran>");
sw.Close();
sw.Dispose();
#endregion
#region ²åÈëÓû§ÐÅÏ¢
XMLDataBase.XMLCommen xmlHelper = new XMLDataBase.XMLCommen(file);
xmlHelper.UpdateAttr("ChkQuaran", "UserID", Session["Userid"].ToString());
xmlHelper.UpdateAttr("ChkQuaran", "UserName", Session["UserName"].ToString());
Ïà¹ØÎĵµ£º
XML(eXtensible Markup Language)ÊÇÍòÎ¬ÍøÁªÃË(World Wide Web Consortium W3C)¶¨ÒåµÄÒ»ÖÖ¿ÉÀ©Õ¹±êÖ¾ÓïÑÔ¡£
¿ÉÀ©Õ¹ÐÔÖ¸ÔÊÐíÓû§°´ÕÕXML¹æÔò×Ô¶¨Òå±ê¼Ç(tags ±êÇ©)¡£
Ç¿ÏÇáËɱí´ï¶à²ã½á¹¹µÄÊý¾Ý£»¿ÉÀ©Õ¹¡£
Óŵ㣺ƽ̨Î޹أ¬ÓïÑÔÎ޹ء£Éè¼ÆÄ¿±êÊÇÃèÊöÊý¾Ý²¢¼¯ÖÐÓÚÊý¾ÝµÄÄÚÈÝ£¬ÓëÏÔʾ·ÖÀë¡£
ÌáÐÑ£º² ......
SQL Server¸ù¾Ý²éѯ½á¹û,Éú³ÉXMLÎļþ
À´Ô´£º²»Ïê ×÷ÕߣºØýÃû ʱ¼ä£º2009-3-6 22:15:58 ·¢²¼£ººÚ¿ÍÈí¼þÔ°
/*
'bcp' ²»ÊÇÄÚ²¿»òÍⲿÃüÁҲ²»ÊÇ¿ÉÔËÐеijÌÐò£¿
¿´¿´ÔÚC:\Program Files\Microsoft SQL Server\80\Tools\BinnÀïÃæÓÐûÓÐbcp.exeÕâ¸öÎļþ
È»ºó¿´¿´pathÀïÃæ¼ÓC:\Program Files\Microso ......
Ò»¡¢Access´ÓExcelÖе¼ÈëÊý¾Ý
1.Óõ½µÄExcel±íµÄ¸ñʽ¼°ÄÚÈÝ
ʵÏÖ
OleDbConnection con = new OleDbConnection();
try
{
OpenFileDialog openFile = new OpenFileDialog();//´ò¿ªÎļþ¶Ô»°¿ò¡£
openFile.Filter = ("Excel Îļþ(*.xls)|*.xls") ......
²úÆ·¼¸ÄêǰʹÓÃASP£¬ºóÀ´Éý¼¶µ½.Net 1.1£¬ÔÙÉý¼¶µ½2.0£¬Ò»Ö±¶¼ÓÐÓÃXSLTת»»XMLÉú³ÉÍøÒ³µÄ·½Ê½£¬ÉÔ΢ÕûÀíÏ¡£
XML file:
<?xml version="1.0" encoding="utf-8" ?>
<ric>
<catalog>
<book price ......
xmlΪ£º
<friendShares>
<totalCount>352</totalCount>
<friendShare>
<code>XXXXXXX</code>
<date>2010-01-15T00:00:00+08:00</date>
<friendId>499</friendId>
<movie>
<code>XXXXXX</code>
<contentId>89718</content ......