易截截图软件、单文件、免安装、纯绿色、仅160KB

更快的写XML的方法

我写的第一个程序中写XML的代码执行速度有些问题,改了一下,现在有所改善。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Data.SqlClient;
using System.Xml;
using System.IO;
using System.Collections;
using System.Threading;
namespace StockUpService
{
public partial class StockUpService : ServiceBase
{
public StockUpService()
{
InitializeComponent();
if (!System.Diagnostics.EventLog.SourceExists("MySource"))
{
System.Diagnostics.EventLog.CreateEventSource(
"MySource", "MyNewLog");
}
eventLog1.Source = "MySource";
eventLog1.Log = "MyNewLog";
}
protected override void OnStart(string[] args)
{
System.Timers.Timer t = new System.Timers.Timer(20000); //实例化Timer类,设置间隔时间为20000毫秒|20秒执行一次;
t.Elapsed += new System.Timers.ElapsedEventHandler(runservice); //到达时间的时候执行事件;
t.AutoReset = true; //设置是执行一次(false)还是一直执行(true);
t.Enabled = true; //是否执行System.Timers.Timer.Elapsed事件;
}
public void runservice(object source, System.Timers.ElapsedEventArgs e)
{
string t;
t = System.DateTime.Now.Hour.ToString()+System.DateTime.Now.Minute.ToString();
if (t == "933")
{
readXml();
}
}
public static void readXml()
{
string classId="";
string filialeId;
string startTime;
string endTime;
string companyType;
string xmlChildNodes = "";


相关文档:

SQLServer2005分解并导入xml文件

  SQLServer2005分解并导入xml文件 收藏
测试环境SQL2005,windows2003
DECLARE @idoc int;
DECLARE @doc xml;
 
SELECT @doc=bulkcolumn from OPENROWSET(
   BULK 'D: \test.xml',
   SINGLE_BLOB) AS x
 
EXEC sp_xml_preparedocument @Idoc OUTPUT, @doc
 
  ......

C# XML注释

作者: J. Andrew Schafer
这篇文章假设你对 XML, XSLT, 和 C# 熟悉
下载这篇文章的源代码: XMLC.exe (76KB)
译者说明:这篇文章是很早以前就发表了,它提供的源代码是基于 VS.net 测试版(RTM 和 Beta 2)的。
摘要
    C# 允许开发人员在源代码中插入XML注释,这在多人协作开发的时候显得特别有用。 ......

读写XML文件

原文:使用 MSXML 分析器处理 XML 文档
#include <atlbase.h>
#include <iostream>
using namespace std;
//<?xml version="1.0"?>
//<xmldata>
    //<xmlnode />
    //<xmltext>Hello, World!</xmltext>
//</xmldata>
void main ......

如何在 XML 文件中取得指定属性的相关值?

两种方法:
其一,使用 SelectNodes 的方法;以下例子为使用此方法的处理。
其二,使用 XQuery 的方法。
    ''' <summary>
    ''' 从 XML 文件中取得对应ID 的语言值
    ''' </summary>
    ''' <param name="textID">输入的ID< ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号