Re: Read only behaviour for a DataTable
Greg Gates <[email protected]> Mon, 17 Jun 2002 09:34:23 -0700
| Newsgroups | gmane.comp.windows.devel.dotnet.general |
|---|---|
| Message-ID | <DOTNET%[email protected]> |
Hello Mark: Thanks very much for your reply. This does give me the behaviour I am after with one caveat. I found that the client could still directly modify data in the table via the Table property of the DataView. Thus the data is still not fully encapsulated. Essentially, I want it to be impossible for the client to directly modify data in the DataTable. If the client wished to modify the data, it would recieve an object instance that wraps a row in the DataTable. Then I have the best of both worlds. Complete control over access to the data, and all the wonderful functionality of the DataSet! However, it may be a problem if the client can bypass this via the DataView table property. thanks , Greg On Tue, 11 Jun 2002 08:12:31 -0700, Mark Boulter <[email protected]> wrote: >You could hand out a DataView with AllowEdit & AllowAdd set to false - I >think this will give you the behavior you are after >mark > >-----Original Message----- >From: Ian Griffiths [mailto:[email protected]] >Sent: Tuesday, June 11, 2002 2:42 AM >To: [email protected] >Subject: Re: [DOTNET] Read only behaviour for a DataTable > >The point being that the DataSet is *always* disconnected. An ADO >recordset >is, by default, attached to the database, so the notion of read-only was >rather more important. With a DataSet any changes that happen to be >made >will not actually have any long term effect unless something explicitly >pushes those updates back to the database. > > >-- >Ian Griffiths >DevelopMentor > >----- Original Message ----- >From: "franklin gray" <[email protected]> > > >Don't think there is anyway to prohit another programmer from changing >the >data in a datatable. > >-----Original Message----- >From: Greg Gates [mailto:[email protected]] > >In "classic" ADO, the ADO recordset had a clone method to which you >could >pass a lock type. One of the lock types was adLockReadOnly. Thus it was >possible to return a reference to an existing ADO recordset and have >read >only behaviour. > >What is the best way to allow a client to obtain a reference to an >existing >ADO.NET data table and also have read only behaviour?. > >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.