Skip to main content
Email Password   helpLost your password?

Introduction

This is my first attempt at writing a Managed Provider. The idea behind it was to allow users of the Managed Provider to be able to fill DataSets from XML in a homogeneous way. This way you could mix XML and database data together without having to know exactly which is from which.

Usage Notes

Example

    // call using: TestXml(@"c:\test.xml", "descendant::server[name='Kay']", 

    //                      "  ", "File Path with XPath Expression");


    static void TestXml(string URL, string XPath, string indent, string Title)
    {
      Console.WriteLine("Testing {0} \nwith XML Source: {1}", Title, URL);
      XmlDataAdapter da = new XmlDataAdapter(XPath, new XmlConnection(URL));

      da.SelectCommand.Connection.Open();
      DataSet ds = new DataSet();
      
      // Test Filling in with all data

      int rowsAffected = da.Fill(ds);
      Console.WriteLine(indent + "Filled DataSet with {0} rows", rowsAffected);
      string xml = ds.GetXml();

      // Test Filling with Schema only

      DataTable[] aTables = da.FillSchema(ds, SchemaType.Source);
      Console.WriteLine(indent + "Filled DataSet with {0} tables of Schema only", 
                        aTables.GetLength(0));

      // Show XML if XPath is used

      if (XPath != "/") Console.WriteLine(indent + "XPath Results: \n{0}", xml);
    }

Caveats

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
Generallooking forward to more on this... Pin
tim mackey
15:11 1 Nov '02  
GeneralWhat is the point of this article? Pin
pbible
6:43 14 Jul '02  
GeneralRe: What is the point of this article? Pin
Shawn Wildermuth
9:16 14 Jul '02  
GeneralRe: What is the point of this article? Pin
AKourkoumelis
10:01 8 Mar '04  


Last Updated 16 Apr 2002 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009