Click here to Skip to main content
15,905,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

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


please help me ....


Thanks & Regards
Srishti
Posted
Updated 15-Oct-13 19:16pm
v2
Comments
Thanks7872 15-Oct-13 8:00am    
BTW,if your ultimate target is to get data in excel then why you want XML?
srishti_ 15-Oct-13 8:21am    
no i dont want to get data in excel ...i want to reporting data in xsl format as per my project requirement...xsl is not excel file its extensible stylesheet language(XSL)
Thanks7872 15-Oct-13 8:26am    
srishti wrote:
xsl is not excel file.

Who says this?

That is why many members ask everyone to post question very clearly. Well,take data into dataset.From DataSet,write the xml file. If you need help doing the same,let me know.

[Use reply button while making comment]
srishti_ 15-Oct-13 8:33am    
please tell me how to write xml file from database table...
srishti_ 16-Oct-13 0:37am    
i am talking about xsl not xls .... xls is excel sheet but xsl

1 solution

See this example:
C#
//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..
 
Share this answer
 
v2
Comments
srishti_ 16-Oct-13 1:17am    
How to open pop up window in asp.net
Thanks7872 16-Oct-13 1:18am    
This is different question. I answered what you asked. Accept this solution if it worked for you and post that as new question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900