| Author |
Topic Search Topic Options
|
dpyers
Senior Member
Joined: 12 May 2003
Status: Offline
Points: 3937
|
Post Options
Thanks(0)
Quote Reply
Posted: 06 November 2003 at 9:30pm |
MorningZ...
Nice piece of code
|
Lead me not into temptation... I know the short cut, follow me.
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
Posted: 07 November 2003 at 5:02am |
thanks..
it could be a little cleaner/less-lines-of-code than it is.. but i wrote that last year when i was just starting to mess around with .NET code.....
|
|
Contribute to the working anarchy we fondly call the Internet
|
 |
Diep-Vriezer
Senior Member
Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
|
Post Options
Thanks(0)
Quote Reply
Posted: 23 November 2003 at 3:25pm |
|
One tiny little more thing > Updating. A config file hasn't got much use if you can't update it, and I was wondering if there was any way of doing so.
|
|
Gone..
|
 |
Mart
Senior Member
Joined: 30 November 2002
Status: Offline
Points: 2304
|
Post Options
Thanks(0)
Quote Reply
Posted: 24 November 2003 at 9:53am |
|
You could select the element using xpath, save all the data to a variable or something then append the element with the old data and the changed variable.
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
Posted: 24 November 2003 at 10:03am |
i think people are losing fact that XML used to store data, such as in config file, shouldn't be treated as a text file, but rather as a representation of data...
you can add/remove/update items/parameters/nodes/whatever just like you were updating records in a database, its just a matter of coding syntax....
but for sure one's gotta start with getting out of the "text file/File System Object" thinking
|
|
Contribute to the working anarchy we fondly call the Internet
|
 |
Diep-Vriezer
Senior Member
Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
|
Post Options
Thanks(0)
Quote Reply
Posted: 24 November 2003 at 12:53pm |
So how should you think..  If you see XML as a database, which is somesort of is, it's still very new to me, so I'll download some e-book about it.
|
|
Gone..
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
Posted: 24 November 2003 at 1:36pm |
There is no difference between going to the database and filling a DataSet, like: Dim objConn As new OleDBConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db\this.mdb") Dim objCmd As new OleDbDataAdapter("SELECT * FROM SITE_Config", objConn) Dim ds As DataSet = new DataSet() objCmd.Fill(ds,"tblUsers")
or using the "LoadXML" method to fill a DataSet, like: Dim dsImageInfo as New DataSet() dsImageInfo.ReadXml( CheckForXMLFile() )
once its in the DataSet, you can manipulate, go through and find, change, add data just like any record set (this article shows some syntax in the "Building a DataTable Programmatically" section), and at the end, there is a "WriteXML" method to resave the file
|
|
Contribute to the working anarchy we fondly call the Internet
|
 |
Diep-Vriezer
Senior Member
Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
|
Post Options
Thanks(0)
Quote Reply
Posted: 25 November 2003 at 5:17am |
|
I know, but I'm not really into datasets.
|
|
Gone..
|
 |