Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Re: handling error with dataSet accessing xml file


Message #1 by Cindy.Somerville@h... on Mon, 2 Dec 2002 17:34:23
This code worked...thank you very much.
Cindy




The following code is a small example which I wrote yesterday. There is 
n> othing wrong. 

> <%@ Page Language="C#" %>
<> %@ Import Namespace="System.Data" %>
<> %@ Import Namespace="System.Data.SqlClient" %>
<> %@ Import Namespace="System.IO" %>
<> script runat="server">
 >    void Page_Load(object sender, EventArgs e)
 >    {
 >        string sourceXml = Server.MapPath("MyCalendar.xml");
 >        if (!(File.Exists(sourceXml)))
 >         {
 >            label.Text="wrong";
 >         }
 >         
 >        DataSet dataSet = new DataSet();
 >        dataSet.ReadXml(sourceXml);
 >        
 >        display.DataSource=dataSet;
 >        display.DataBind();
 >    }

> </script>
<> html>
<> head>
<> /head>
<> body>
 >    <form runat="server">
 >        <asp:DataGrid id=display runat=server/>
 >        <asp:Label id=label runat=server/>
 >    </form>
<> /body>
<> /html>

  Return to Index