Home All Groups Group Topic Archive Search About

Read only copy of DataSet

Author
18 Feb 2006 2:27 PM
Praveen
Hi All,
I wanted to get readonly copy of a Dataset instance. Dataset has a Copy
Function which can give me a give me a copy of the dataset but I did not
find a way to make it readonly.

I found a workaround like below is there a better way to do this ?
Thanks in advance,
Praveen

foreach(DataTable DT in CP.Tables)
{
    foreach(DataColumn DC in DT.Columns)
    {
        DC.ReadOnly = true;
     }
}

Author
18 Feb 2006 3:24 PM
Scott M.
Why not just use a DataReader instead?

Show quote
"Praveen" <praveen@newsgroup.nospam> wrote in message
news:%23ooTUdJNGHA.2300@TK2MSFTNGP15.phx.gbl...
> Hi All,
> I wanted to get readonly copy of a Dataset instance. Dataset has a Copy
> Function which can give me a give me a copy of the dataset but I did not
> find a way to make it readonly.
>
> I found a workaround like below is there a better way to do this ?
> Thanks in advance,
> Praveen
>
> foreach(DataTable DT in CP.Tables)
> {
>    foreach(DataColumn DC in DT.Columns)
>    {
>        DC.ReadOnly = true;
>     }
> }
>
Author
18 Feb 2006 9:19 PM
Miha Markic [MVP C#]
If you are talking about UI-readonly then you might put BindingSource (.net
2) in between and set it as readonly.
Or you can just lock UI consumer - depends on the consumer.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Show quote
"Praveen" <praveen@newsgroup.nospam> wrote in message
news:%23ooTUdJNGHA.2300@TK2MSFTNGP15.phx.gbl...
> Hi All,
> I wanted to get readonly copy of a Dataset instance. Dataset has a Copy
> Function which can give me a give me a copy of the dataset but I did not
> find a way to make it readonly.
>
> I found a workaround like below is there a better way to do this ?
> Thanks in advance,
> Praveen
>
> foreach(DataTable DT in CP.Tables)
> {
>    foreach(DataColumn DC in DT.Columns)
>    {
>        DC.ReadOnly = true;
>     }
> }
>
Author
20 Feb 2006 1:09 PM
Praveen
The dataset that I am using does not bind to the any UI. I am using that in
a dll.

Regards,
Praveen


Show quote
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:%23gvB0DNNGHA.2320@TK2MSFTNGP11.phx.gbl...
> If you are talking about UI-readonly then you might put BindingSource
> (.net 2) in between and set it as readonly.
> Or you can just lock UI consumer - depends on the consumer.
>
> --
> Miha Markic [MVP C#]
> RightHand .NET consulting & development www.rthand.com
> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>
> "Praveen" <praveen@newsgroup.nospam> wrote in message
> news:%23ooTUdJNGHA.2300@TK2MSFTNGP15.phx.gbl...
>> Hi All,
>> I wanted to get readonly copy of a Dataset instance. Dataset has a Copy
>> Function which can give me a give me a copy of the dataset but I did not
>> find a way to make it readonly.
>>
>> I found a workaround like below is there a better way to do this ?
>> Thanks in advance,
>> Praveen
>>
>> foreach(DataTable DT in CP.Tables)
>> {
>>    foreach(DataColumn DC in DT.Columns)
>>    {
>>        DC.ReadOnly = true;
>>     }
>> }
>>
>
>
Author
21 Feb 2006 2:50 AM
Kevin Yu [MSFT]
Hi Praveen,

Then the only way is to set all the DataColumns in all Tables to be
readonly.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

AddThis Social Bookmark Button