By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,857 Members | 1,813 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,857 IT Pros & Developers. It's quick & easy.

read and write to xml

P: n/a
i read some article that it's better to store some information to xml
than using an ini file. suppose to be i want to read and write this
data:

file name="my.ini"

[ConnectionString]
Server="myServer"
UID="myUID"
Password="myPassword"
Database="myDatabase"

so anybody know how can i do this in vb.net? i want to know what is
the server name, uid, password, database. i want to read from xml to
be use by my sql connection.

thanks in advance
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The really easy was is to create a datatable with 4 columns, add a row,
store those values, and then use DataSet.WriteXML(@"Path:\File.xml"); You
can reference the values by myDataSet.Tables[0].Rows[0][0] for the first
column [0][1] for the second etc.

You can just use myDataSet.ReadXML(@"Path:\File.xml") and reference just as
above

Another easy was is storing it iin the Config file.
http://www.knowdotnet.com/articles/configfiles.html which you can do very
easily and use DynamicProperties.
You can also make a class and specify it as serializable, use attributes for
each property and use Serialize Deserialize

Using ini files isn't 'bad' it's just old school and there are easier, more
OOP way like config files.
HTH,

Bill
"jaYPee" <hi******@yahoo.com> wrote in message
news:1d********************************@4ax.com...
i read some article that it's better to store some information to xml
than using an ini file. suppose to be i want to read and write this
data:

file name="my.ini"

[ConnectionString]
Server="myServer"
UID="myUID"
Password="myPassword"
Database="myDatabase"

so anybody know how can i do this in vb.net? i want to know what is
the server name, uid, password, database. i want to read from xml to
be use by my sql connection.

thanks in advance

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.