使用类型化数据集时出现问题
Dataset _dBSettings;
_dBSettings = SqlHelper.ExecuteDataset(_connectionString, CommandType.StoredProcedure, "usp_GetTCMSData");
我有 DataSet
现在它是一个非类型化数据集;它包含 10 张桌子。我想将非类型化数据集分配给类型化数据集 - 我该怎么做?
喜欢:
typeDs = _dBSettings;
Dataset _dBSettings;
_dBSettings = SqlHelper.ExecuteDataset(_connectionString, CommandType.StoredProcedure, "usp_GetTCMSData");
I have DataSet
now it is an untyped dataset; it contains 10 tables. I want to assign to the untyped dataset to a typed dataset - how can I do that?
Like:
typeDs = _dBSettings;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法在非类型化数据集和类型化数据集之间进行分配。类型化数据集是由数据集设计者生成的类。如果您转到 Windows 资源管理器并导航到其中包含类型化数据集的文件夹,您将看到许多与类型化数据集相关的文件,其中之一是 Designer.cs 文件。如果你打开它你会看到类似的东西
基本上,您必须编写代码将数据从非类型化数据移动到类型化数据。
You can't do an assignment between an untyped dataset and a typed one. A typed dataset is a class that is generated by the dataset designer. If you go to windows explorer and navigate to the folder with the typed dataset in it you'll see a number of files relating to your typed dataset, one of them will be a Designer.cs file. If you open that up you'll see something like
Basically you are going to have to write code to move the data from the untyped one to the typed one.