以xml格式或xls表格显示数据 [英] display data in xml format or xls sheet

查看:144
本文介绍了以xml格式或xls表格显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



i在我的数据库中有一个表让zip_codes在那里有三个字段.....我想在我的dot net xml文件中显示这些数据所以我可以将它转换为xsl文件我该怎么做....



我的表格脚本是



Hello ,

i have a table in my database let zip_codes in there three fields ..... i want to show this data in my dot net xml file so that i can covert it to xsl file how can i do this ....

My table script is

CREATE TABLE [zip_codes](
    [zip_code] [varchar](20) NOT NULL,
    [state_abbrev] [varchar](15) NOT NULL,
    [city] [varchar](30) NULL
)





请帮帮我....




谢谢&问候

Srishti

推荐答案

查看此示例:
//Create and open the connection
SqlCommand cmd = new SqlCommand("select zip_code,state_abbrev,city from zip_codes", your connection);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
ds.WriteXml("C:\\your_file.xml");
your connection.Close();



问候..


Regards..


这篇关于以xml格式或xls表格显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆