I guess I didn't understand your question. Perhaps someone else can help
you.

Richard Spence

-----Original Message-----
From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of
Richard Grimes
Sent: Friday, May 03, 2002 1:31 AM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Dataset problem


----- Original Message -----
From: "Richard Spence" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 02, 2002 10:37 PM
Subject: Re: [DOTNET] Dataset problem


> Try adding:  #using <system.configuration>
>

Can you explain what use this will be?

The configuration APIs are read-only, and I want to _write_ to a file.

Also, I have used a config file as an example, but the situation is generic.
I am doing something wrong (or DataSet is) because when the DataSet is
persisted as XML it is putting the item outside of the collection that I
specify.

Richard

> -----Original Message-----
> From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of
> Richard Grimes
> Sent: Thursday, May 02, 2002 9:48 AM
> To: [EMAIL PROTECTED]
> Subject: [DOTNET] Dataset problem
>
>
> I have tried every combination I can think of, but I cannot get this to
> work. Has anyone got any suggestions?
>
> When I run this code I get the three <add> statements under the
> <configuration> element and not under the <appSettings> element.
>
> Richard
>
>
> www.grimes.demon.co.uk
>
> #using <mscorlib.dll>
> #using <system.data.dll>
> #using <system.dll>
> #using <system.xml.dll>
>
> using namespace System;
> using namespace System::Data;
>
> void ChangeValue(DataSet* data, String* name, String* value)
> {
>    DataTable* dt = data->Tables->Item[S"appSettings"];
>    if (dt != 0)
>    {
>       DataRelation* add = dt->ChildRelations->Item[S"appSettings_add"];
>       if (add != 0)
>       {
>          DataTable* addTable = add->ChildTable;
>          DataRow* dr = addTable->NewRow();
>          dr->Item[S"key"] = name;
>          dr->Item[S"value"] = value;
>          addTable->Rows->Add(dr);
>       }
>    }
> }
>
> void main()
> {
>    DataSet* data = new DataSet;
>    data->ReadXml(
>          AppDomain::CurrentDomain->SetupInformation->ConfigurationFile);
>
>    ChangeValue(data, S"One", S"1");
>    ChangeValue(data, S"Two", S"2");
>    ChangeValue(data, S"Three", S"3");
>
>    data->AcceptChanges();
>    data->WriteXml(
>          AppDomain::CurrentDomain->SetupInformation->ConfigurationFile);
> }
>
> You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
>
> You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to