There are kinda 2 ways you can go about this:
Treat your xml as a XmlDocument
that would involve you writing Xpath statements to find data.
And would return XmlNodeList objects.
OR
Treat your backend data as a DataSet ( a strongly typed one would be
better).
However, to do this, the xml has to be in a specific format. (DataSet
friendly).
I would suggest this:
Create your own strong dataset object.
Right click / Add New Item (DataSet)
Call it "MyFirstDataSet".
Add a table in the designer. (if youre in 2.0 , DELETE the table adapter
that gets auto created at the bottom)
Add a table like "Employee"
add columns like "SSN" , "LastName" , "FirstName".
MyFirstDataSet ds = new MyFirstDataSet();
ds.Employee.AddNewEmployeeRow ( "222222222" , "Smith" , "John" ) ;
ds.Employee.AddNewEmployeeRow ( "333333333" , "Jones" , "Mary" ) ;
ds.WriteXml (@"C:\myds.xml");
...............
There is a ReadXml method as well.
IF you do this, you'll see how the xml is formed, when you open the file in
notepad.
Then you can do stuff like
MyFirstDataSet ds = new MyFirstDataSet();
ds.ReadXml(@"C:\myds.xml");
ds.Employee.Select ("SSN='222222222'");
well, you gotta figure out what the above returns, and get a ref to it.
The above should return 1 DataRow (I think?) and you'll be able to cast it
as a
MyFirstDataSet.EmployeeRow object.
Something like that.
If you go with a pure XmlDocument model, you'll have to learn some Xpath.
If you want to go with a DataSet route, AND you don't have dataset friendly
Xml to begin with, you can do this:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!148.entry
...
"slinky" <ca***************@yahoo.comwrote in message
news:11**********************@u2g2000hsc.googlegro ups.com...
I'm struggling with what should be a very basic .aspx/XML issue. I
have an XML file. I have a textbox for a user to enter data and a
button to submit the data. I don't wont the user to see the other
records on the screen. I'm using Visual Web Developer Express 2005,
vb.NET) I've tried several different strategies from books and online
examples, but I can't seem to get anywhere. I'm guessing I need to Dim
a DataSet (even though I'm adding only one record). Of course I need
to pass the value of my textbox into the XML file via an event handler
on the button's code. Should I embed and INSERT query string into the
button's click event? Please any advice would be appreciated. Thanks!