Loading Data into DataSet From XML

G

Guest

I'm having a hard time making the jump from VB6 and ASP to the .NET Compact Framework. Specifically, I can make the regular examples work, get data from SQL and XML, write to SQL and XML, but it all comes to a halt when I try it for a Smart Device.

Trying to read from XML gives me a "FileNotFound Exception" or "IO Exception". I'm putting the XML file in the right place (I've actually tried it in ALL the places it could go) and I'm stumped. The app is going to run in Windows CE on an Intermec mobile computer.

Can anybody help me or point me to a resource that can help? I'm even ready to take a class --- IF I can find one.
 
G

Ginny Caughey [MVP]

Art,

I'm guessing that the file isn't where you expect. One of the first things
that surprises developers just starting out with devices is that Windows CE
has no concept of "current directory" so all file names must be fully
qualified.

--
Ginny Caughey
..Net Compact Framework MVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups



Art Cabot said:
I'm having a hard time making the jump from VB6 and ASP to the .NET
Compact Framework. Specifically, I can make the regular examples work, get
data from SQL and XML, write to SQL and XML, but it all comes to a halt when
I try it for a Smart Device.
Trying to read from XML gives me a "FileNotFound Exception" or "IO
Exception". I'm putting the XML file in the right place (I've actually tried
it in ALL the places it could go) and I'm stumped. The app is going to run
in Windows CE on an Intermec mobile computer.
Can anybody help me or point me to a resource that can help? I'm even
ready to take a class --- IF I can find one.
 
G

Guest

I've looked at the way the sample apps handle it and have tried to do it the same way. For example, if the executable is running in the \bin folder and I put my XML file in the folder that holds the \bin folder, then my code is

dsMyData.readXML("../myDataFile.xml")

If that's not correct, then somebody PLEASE point me in the right direction. This is driving me crazy!!!
--
Art Cabot
Strickland Technical Services, Inc.
Augusta, Georgia


Ginny Caughey said:
Art,

I'm guessing that the file isn't where you expect. One of the first things
that surprises developers just starting out with devices is that Windows CE
has no concept of "current directory" so all file names must be fully
qualified.

--
Ginny Caughey
..Net Compact Framework MVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups



Art Cabot said:
I'm having a hard time making the jump from VB6 and ASP to the .NET
Compact Framework. Specifically, I can make the regular examples work, get
data from SQL and XML, write to SQL and XML, but it all comes to a halt when
I try it for a Smart Device.
Trying to read from XML gives me a "FileNotFound Exception" or "IO
Exception". I'm putting the XML file in the right place (I've actually tried
it in ALL the places it could go) and I'm stumped. The app is going to run
in Windows CE on an Intermec mobile computer.
Can anybody help me or point me to a resource that can help? I'm even
ready to take a class --- IF I can find one.
 
G

Ginny Caughey [MVP]

Art,

If the file is located in the \Program Files\Your app\bin folder use
dsMyData.ReadXML("\Program Files\Your app\bin\myDataFile.XML") or double the
back-slashes for C#.

--
Ginny Caughey
..Net Compact Framework MVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups



Art Cabot said:
I've looked at the way the sample apps handle it and have tried to do it
the same way. For example, if the executable is running in the \bin folder
and I put my XML file in the folder that holds the \bin folder, then my code
is
dsMyData.readXML("../myDataFile.xml")

If that's not correct, then somebody PLEASE point me in the right
direction. This is driving me crazy!!!
--
Art Cabot
Strickland Technical Services, Inc.
Augusta, Georgia
 
G

Guest

Thank you so much for trying to help on this. I'm running from a network directory, so if \Program Files is relative to the root of the C: drive, do I give it a path that's relative to the root of the mapped drive it's on?

Maybe what's confusing me is the fact that the sample apps have it the way I noted previously. In other words, if it was running from R:\My Documents\Folder1\Folder2\Bin, with myFile.xml in \Folder2, then dsMyDataSet.readXML("../myFile.xml") worked.

I was using the "Creating an Offline Application" from the VB .NET Resource Kit as my sample code.

Art

--
Art Cabot
Strickland Technical Services, Inc.
Augusta, Georgia
 
G

Ginny Caughey [MVP]

Art,

For a device app, you should be running on the device or emulator, and the
device or emulator doesn't have a C: drive. You can easily deploy your XML
file to the same directory on the emulator or device as your app by adding
the XML file to your project and setting its Build Action to Content.

--
Ginny Caughey
..Net Compact Framework MVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups



Art Cabot said:
Thank you so much for trying to help on this. I'm running from a network
directory, so if \Program Files is relative to the root of the C: drive, do
I give it a path that's relative to the root of the mapped drive it's on?
Maybe what's confusing me is the fact that the sample apps have it the way
I noted previously. In other words, if it was running from R:\My
Documents\Folder1\Folder2\Bin, with myFile.xml in \Folder2, then
dsMyDataSet.readXML("../myFile.xml") worked.
I was using the "Creating an Offline Application" from the VB .NET
Resource Kit as my sample code.
 
G

Guest

Will give that a try this morning.

I really appreciate the help, Ginny. Your name is familiar. I think you've helped me in the past on one of the forums. It's hard working solitary and I so appreciate those who are willing to share their experience.

Thanks.

--
Art Cabot
Strickland Technical Services, Inc.
Augusta, Georgia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top