技术开发 频道

一步一步学Linq to sql:存储过程


【IT168技术文档】

  普通存储过程

  首先在查询分析器运行下面的代码来创建一个存储过程:
create proc sp_singleresultset as set nocount on select * from customers
  然后打开IDE的服务器资源管理器,之前我们从表中拖动表到dbml设计视图,这次我们从存储过程中找到刚才创建的存储过程,然后拖动到设计视图。在方法面板中可以看到已经创建了一个sp_singleresultset的方法,如下图:

  然后打开Northwind.designer.cs,可以找到下面的代码:
[Function(Name="dbo.sp_singleresultset")] public ISingleResult<sp_singleresultsetResult> sp_singleresultset() { IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod()))); return ((ISingleResult<sp_singleresultsetResult>)(result.ReturnValue)); }
0
相关文章