通过 LINQ-to-SQl 加载数据集
我有一个返回 DataSet 的存储过程。该存储过程通过实体数据模型在我的 C# 代码中公开。如何在我的代码中获取数据集?上下文不断尝试自动生成一组强类型的对象。但是,这些对象仅代表第一个结果集。我的 DataSet 有 4 个结果集。这是我正在使用的代码:
using (DBDataContext context = new DBDataContext())
{
var myDataSet = context.LoadData(); // Load data is the name of my sproc
// how do I get a DataSet here?
}
How do I get a DataSet via LINQ-to-SQL, or LINQ-to-EntityDataModel, or无论它被称为?
非常感谢您的帮助
I have a stored procedure that returns a DataSet.This stored procedure is exposed in my C# code via an Entity Data Model. How do I get the DataSet in my code? The context keeps trying to automatically generate a strongly-typed set of objects. However, those objects only represent the first result set. My DataSet has 4 result sets in it. Here is the code I'm using:
using (DBDataContext context = new DBDataContext())
{
var myDataSet = context.LoadData(); // Load data is the name of my sproc
// how do I get a DataSet here?
}
How do I get a DataSet via LINQ-to-SQL, or LINQ-to-EntityDataModel, or whatever it is called?
Thank you very much for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有多个结果集,那么您需要编写一些代码 - 但这并不难:
网上有一些示例 - 例如:
它们主要显示扩展您的部分内容所需的内容datacontext 类似于:
或在 C# 中类似于:
希望对
Stuart有帮助
If you have multiple result sets then you need to write some code - but it's not hard:
There's a few examples out there on the web - e.g.:
They mostly show what's needed as extending your partial datacontext with something like:
or in C# as something like:
Hope that helps
Stuart