Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using XMLAdapter to create a dataset
Message
From
04/01/2005 10:51:09
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Environment versions
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00973971
Message ID:
00974087
Views:
21
Paul,

In Tim's reply, he mentions that it must be utf8 encoded and that you need to set

loXMLAdapter.UTF8Encoded = .t.

What's interesting, is that I tried using the XMLAdapter with a few different tables *without* setting the UTF8 encoding and it worked just fine. My tables had char, logical, int, decimal ... even some memos and dates. All worked fine. So, I'm curious as to what kind of data causes the format errors. Anything peculiar in the table you're using?

I wonder if versions matter?
I'm using VS.NET 2003 and VFP 8.

~~Bonnie



>I'm using the XMLAdapter to create (what I though) was the equivalent of a serialized dataset, so I can access it from a .NET app (more specifically, the compact framework).
>
>Here's the code I'm using:
>
>
>loXML = CREATEOBJECT("XMLAdapter")
>loXML.AddTableSchema("MyTable")
>loXML.ToXML("C:\test.xml", "", .T.)
>
>
>Is there something more to it than that? When I attempt to access it from .NET (from the .ReadXml() line), I get a FormatException thrown.
>
>Here's the code:
>
>
>System.Data.DataSet dsTest = new System.Data.DataSet();
>try
>   {				
>      dsTest.ReadXml(@"test.xml");
>      System.Data.DataRow drTest = dsTest.Tables[0].Rows[0];
>      this.txtTest.Text = drTest["company"].ToString();
>   }
>   catch (FormatException ex)
>   {
>      this.txtTest.Text = "Error loading data..." + ex.Message.ToString();
>   }
>
>
>I even tried using a filestream instead to read the file, with the same results. So, I'm assuming I need to set something else in VFP, but I'm not entirely sure what.
>
>Ideas?
>
>Thanks,
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform