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

利用SqlHelper(ExecuteXmlReader使用),转换到xml格式

利用sqlhelper中的ExcuteXmlReader方法,读取数据并保存为xml文件     
 string strConn = Properties.Settings.Default.Connections;
           SqlConnection connection = new SqlConnection(strConn);
         ---注意:后面的for格式
           string strsql = "select * from p where name=@name and other=@other FOR XML AUTO,root('root'),elements";
     
            SqlParameter[] sqlp = new SqlParameter[2];
            sqlp[0] = new SqlParameter("@name", "pp");
            sqlp[1] = new SqlParameter("@other", "ss");
            xr = SqlHelper.ExecuteXmlReader(connection, CommandType.Text, strsql,
               sqlp);
           XmlDocument xml = new XmlDocument();
           xml.Load(xr);
           xml.Save(Application.StartupPath + "\\test1.xml");


相关文档:

读写xml所有节点个人小结 和 读取xml节点的数据总结

//打开某文件(假设web.config在根目录中)
     string filename=Server.MapPath("/") + @"WebApplication1\web.config";
     XmlDocument xmldoc= new XmlDocument();
     xmldoc.Load(filename);
     //得到顶层节点列表
  ......

java 将EXCEL表格数据转换成XML格式

有时候我门需要把EXCEL表格中的数据转换成XML格式 这需要用到JXL(分析EXCEL)包和JDOM包(构成XML)
import java.io.*;
import jxl.*;
import org.jdom.Element;
import org.jdom.Document;
import org.jdom.output.XMLOutputter;
/**
 *
 * @author guo
 */
public class EtoX {
    ......

创建自定义排序DataGrid控件的例子(读取xml)

<?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 ......

用Dom4J解析带命名空间的XML文件

Dom4J是一个开源的优秀的XML解析API,现在越来越多的项目中开始采用这种解析方式,其中包含了著名的Hibernate。这里我们使用Dom4J解析一个带命名空间的CXF的Spring配置文件。先导入dom4j-1.6.1.jar
spring 配置文件 applicationContext-cxf.xml:
 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=" ......

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身份验证
//s ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号