Linq to sql:
来源:互联网 发布:炫彩表白软件 编辑:程序博客网 时间:2024/04/28 14:26
多结果集的存储过程
再来创建一个多结果集的存储过程:
create proc [dbo].[sp_multiresultset]
as
set nocount on
select *from customers
select *from employees
找到生成的存储过程方法:
[Function(Name="dbo.sp_multiresultset")]
public ISingleResult<sp_multiresultsetResult> sp_multiresultset()
{
IExecuteResult result =this.ExecuteMethodCall(this,
((MethodInfo)(MethodInfo.GetCurrentMethod())));
return ((ISingleResult<sp_multiresultsetResult>)(result.ReturnValue));
}
由于现在的VS2008会把多结果集存储过程识别为单结果集存储过程(只认识第一个
结果集),我们只能对存储过程方法多小动手术,修改为:
[Function(Name="dbo.sp_multiresultset")]
[ResultType(typeof(Customer))]
[ResultType(typeof(Employee))]
public IMultipleResults sp_multiresultset()
{
IExecuteResult result =this.ExecuteMethodCall(this,
((MethodInfo)(MethodInfo.GetCurrentMethod())));
return (IMultipleResults)(result.ReturnValue);
}
然后使用下面的代码测试:
var 多结果集存储过程 = ctx.sp_multiresultset();
var Customers = 多结果集存储过程.GetResult<Customer>();
var Employees = 多结果集存储过程.GetResult<Employee>();
GridView1.DataSource = from emp inEmployeeswhere
emp.FirstName.Contains("A")select emp;
GridView1.DataBind();
GridView2.DataSource = from c inCustomerswhere
c.CustomerID.StartsWith("A")select c;
GridView2.DataBind()
- linq,linq to sql
- Linq初探--Linq to SQL
- LINQ to SQL 学习
- 什么是Linq to sql
- 使用LINQ to SQL
- 深入LINQ to SQL
- Linq To Sql注意事项
- Linq to SQL:基础知识
- LINQ to SQL实例
- 使用LINQ to SQL
- LINQ to SQL语句
- Linq to sql(一)
- LINQ to SQL语句
- LINQ TO SQL--insert
- LINQ TO SQL--delete
- LINQ TO SQL--update
- LINQ TO SQL--select
- Linq to SQL 资源
- Linq to sql:带返回值的存储过程
- iOS界面-仿网易新闻左侧抽屉式交互
- java产生随机数通用函数
- [杭州] 前端开发攻城师-招聘
- 构建和实现单点登录解决方案
- Linq to sql:
- SilverLight概述
- [leetcode] Sqrt(x)
- 关于 windows 互斥锁CRITICAL_SECTION 多次加锁,需要多少释放的问题
- HDU1004——Let the Balloon Rise
- Asterisk 未来之路3.0_0006
- 如何使用飞秋FeiQ实现两电脑通信(或传输文件)
- Linq to sql:使用存储过程新增数据
- OnClose()和OnDestroy()