Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 1st, 2007, 07:09 AM
Authorized User
 
Join Date: Dec 2006
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default create XML from database table

hi,
I am trying to create a XML file from a SQL Server database table. But it is showing an error. My code is :

using (StreamWriter sw = File.CreateText(path))
{
    string source = ConfigurationSettings.AppSettings["dbString"];
    SqlConnection con = new SqlConnection(source);
    SqlXmlCommand cmd = new SqlXmlCommand(source);
    cmd.CommandText = "select * from node_master";
    cmd.RootTag = "TREENODES";
    cmd.CommandType = SqlXmlCommandType.Sql;
    DataSet ds = new DataSet();
    SqlXmlAdapter xa = new SqlXmlAdapter(cmd);
    xa.Fill(ds);
    ds.WriteXml(sw, XmlWriteMode.IgnoreSchema);
}

But it is showing an "System error" in the Red line.
Error is:
Exception Details: Microsoft.Data.SqlXml.ConnectionStringNotSetExcept ion: System error.

How can I solve this problem?
Angshujit

__________________
Angshujit





Similar Threads
Thread Thread Starter Forum Replies Last Post
Create generic XSL Template to create table Venkatachalapathy XSLT 5 March 11th, 2008 07:49 AM
create 2-columns table from an XML document frosty1575 XSLT 2 May 16th, 2006 04:17 AM
Problem to create an xml file from two xml files saurabh_inblore XSLT 1 April 12th, 2006 02:58 AM
How to Create Table in Database from MSHFlexGrid davekrunal46 VB How-To 0 November 30th, 2005 03:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.