|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
IntroductionThis 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 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
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||