Read only copy of DataSet

P

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;
}
}
 
M

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.
 
P

Praveen

The dataset that I am using does not bind to the any UI. I am using that in
a dll.

Regards,
Praveen


Miha Markic said:
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 said:
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;
}
}
 
K

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."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top