PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
XML to Table inference
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
XML to Table inference
![]() |
XML to Table inference |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
I have a simple config.ini to be read into a simple table with three columns: accountID, port, base_path. Reading this page: http://msdn.microsoft.com/library/d...rringtables.asp has led me to try various permutations of XML for my config file (see example below). Anyway, I need to figure out how to set up the XML and my code to get the values. Any pointers greatly appreciated! Regards, Raj My code is: DataSet ds = new DataSet(); ds.ReadXml("config.ini", XmlReadMode.Auto); DataTable account = ds.Tables["account"]; foreach (DataRow accountRow in account.Rows) { ThreadWithState myThread = new ThreadWithState((string)accountRow["port"], (string)accountRow["account"],(string)accountRow["base_path"],myTWS); . . .} And my current config.ini incarnation is: <?xml version="1.0" standalone="yes"?> <accounts> <account> <accountID>"account1"</accountID> <port>"port1"</port> <base_path>"C:\Documents and Settings\Rawall\Desktop\TWS Accounts\Account1"</base_path> <!--next account--> <accountID>"account2"</accountID> <port>"port2"</port> <base_path>"C:\Documents and Settings\Rawall\Desktop\TWS Accounts\Account2"</base_path> <!--next account--> <accountID>"account3"</accountID> <port>"port3"</port> <base_path>"C:\Documents and Settings\Rawall\Desktop\TWS Accounts\Account3"</base_path> </account> </accounts> |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Raj,
If everything fails to get an XML file will this mostly do it. http://www.vb-tips.com/default.aspx...6a-22589f018cd4 I hope this helps, Cor "Raj Wall" <metanalogy@nospam.nospam> schreef in bericht news:%23oEkg2ZXGHA.3684@TK2MSFTNGP05.phx.gbl... > Hi, > > I have a simple config.ini to be read into a simple table with three > columns: accountID, port, base_path. > > Reading this page: > http://msdn.microsoft.com/library/d...rringtables.asp > has led me to try various permutations of XML for my config file (see > example below). Anyway, I need to figure out how to set up the XML and my > code to get the values. Any pointers greatly appreciated! > > Regards, > Raj > > My code is: > DataSet ds = new DataSet(); > > ds.ReadXml("config.ini", XmlReadMode.Auto); > > DataTable account = ds.Tables["account"]; > > foreach (DataRow accountRow in account.Rows) > > { > > ThreadWithState myThread = new ThreadWithState((string)accountRow["port"], > (string)accountRow["account"],(string)accountRow["base_path"],myTWS); > > . . .} > > And my current config.ini incarnation is: > <?xml version="1.0" standalone="yes"?> > > <accounts> > > <account> > > <accountID>"account1"</accountID> > > <port>"port1"</port> > > <base_path>"C:\Documents and Settings\Rawall\Desktop\TWS > Accounts\Account1"</base_path> > > <!--next account--> > > <accountID>"account2"</accountID> > > <port>"port2"</port> > > <base_path>"C:\Documents and Settings\Rawall\Desktop\TWS > Accounts\Account2"</base_path> > > <!--next account--> > > <accountID>"account3"</accountID> > > <port>"port3"</port> > > <base_path>"C:\Documents and Settings\Rawall\Desktop\TWS > Accounts\Account3"</base_path> > > </account> > > </accounts> > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

