Delphi:使用TClientDataset作为内存数据集 [英] Delphi: using TClientDataset as an in-memory dataset

查看:770
本文介绍了Delphi:使用TClientDataset作为内存数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据此页面,可以使用TClientDataset作为内存数据集,完全独立于任何实际的数据库或文件。它描述了如何设置数据集的表结构以及如何在运行时将数据加载到其中。但是当我试图遵循D2009中的指示时,第4步(table.Open)引发了异常。它表示它没有指定提供程序。

According to this page, it's possible to use TClientDataset as an in-memory dataset, completely independent of any actual databases or files. It describes how to setup the dataset's table structure and how to load data into it at runtime. But when I tried to follow its instructions in D2009, step 4 (table.Open) raised an exception. It said that it didn't have a provider specified.

该页面上的示例的整个一点是构建一个不需要提供程序的数据集。页面错了,是否过时了,还是我在某处失踪?如果页面错误,我需要用什么来创建一个完全独立的内存数据集?我一直在使用TJvMemoryData,但如果可能,我想减少我的数据集添加到我的项目中的额外依赖的数量。

The entire point of the example on that page is to build a dataset that doesn't need a provider. Is the page wrong, is it outdated, or am I missing a step somewhere? And if the page is wrong, what do I need to use instead to create a completely independent in-memory dataset? I've been using TJvMemoryData, but if possible I'd like to reduce the amount of extra dependencies that my dataset adds into my project.

推荐答案

在运行时,您可以使用table.CreateDataset,或者如果这是在设计界面上,您可以右键单击CDS并单击create dataset。您需要为CDS指定列/类型,然后才能执行此操作。

at runtime you can use table.CreateDataset or if this is on a design surface you can right click on the CDS and click create dataset. you need to have specified columns/types for the CDS before you can do this though.

这篇关于Delphi:使用TClientDataset作为内存数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆