简体   繁体   English

如何创建一个简单的只读TDataSet来访问内存结构

[英]How to create a simple READ-ONLY TDataSet to access a memory structure

I have a memory structure which is (pretty much) static and read-only. 我有一个(几乎)静态和只读的内存结构。 I would like to present its data as a TDataSet descendent to enable me to use DB grids etc to view / report the data. 我想将其数据显示为TDataSet后代,以使我能够使用DB网格等查看/报告数据。 I have no need of editing (in fact this must be prohibited). 我不需要编辑(实际上必须禁止这样做)。 I've see this SO question and other advice that some home-rolled code 'has problems with bookmarks'. 我看到了这样的问题以及其他一些建议,即一些自家编写的代码“书签存在问题”。 I really only want a simple solution and ideally this would be where I could create a simple 'virtual' table with my known field types and then be given an 'OnGetFieldData' event for each one. 我真的只想要一个简单的解决方案,理想情况下,这将是我可以使用已知的字段类型创建一个简单的“虚拟”表,然后为每个表赋予一个“ OnGetFieldData”事件的地方。 My other choice is to use a DevExpress TDxMemData in-memory table and populate it on changes in my data but this is less efficient and more messy. 我的另一选择是使用DevExpress TDxMemData内存表,并根据我的数据更改填充它,但这效率较低且更混乱。 Is there any other solution? 还有其他解决方案吗?

Don't use TDataSet descendant, use LiveBindings instead. 不要使用TDataSet后代,而应使用LiveBindings。 Your situation is exactly what they were created for. 您的情况正是他们创建的目的。 Here are some videos about their use: http://www.embarcadero.com/coderage/sessions 以下是有关其用法的一些视频: http : //www.embarcadero.com/coderage/sessions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM