|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Read only copy of DataSetHi 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; } } 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; > } > } > 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. -- Show quoteMiha 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; > } > } > 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; >> } >> } >> > > |
|||||||||||||||||||||||