如何使用entityframework编写用于显示计数的存储过程 [英] how to write stored procedure for displaying count using entityframework

查看:89
本文介绍了如何使用entityframework编写用于显示计数的存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,







我想使用存储过程显示计数,我想要存储过程的导入函数使用实体框架向标签显示计数,告诉我使用实体框架工作的新步骤





I want to display the count using stored procedure and i want to import function for stored procedure to display count to the label using entity framework,tell me step by step procedure am new to using entity frame work

推荐答案

check 实体框架中的存储过程 [ ^ ]将为您提供帮助。
check Stored Procedure in Entity Framework[^] will help you.


步骤1:创建存储数据库中的过程。

步骤2:转到实体框架.edmx页面。从数据库中选择更新模型(如果已添加实体数据模型)或转到解决方案资源管理器添加新项目,然后选择ado .net实体数据模型,然后从数据库中选择生成,然后添加新连接,提供凭据,然后选择功能和存储过程窗口,选择数据库并单击完成。

步骤3:转到模型浏览器窗口(仅在打开.edmx时出现),然后转到datamodel,然后选择函数导入,添加函数导入,然后给出名称,从drop中选择存储过程向下,然后选择实体单选按钮,选择实体,选择获取列信息,确定。



现在你可以通过linq查询获得结果。
Step 1: Create the stored procedure in the database .
Step 2: Go to entity framework .edmx page . choose update model from database(if already added entity datamodel ) or goto solution explorer add new item ,then choose ado .net entity data model ,then choose generate from database,then add new connection,give credentials,then choose function and stored procedure window,select the database and click on finish.
step 3: Goto model browser window(appears only when .edmx is opened),then goto datamodel,then choose "function import",add function import,then give name,select the stored procedure from drop down,then choose "entities" radio button,select the entity,choose get collumn info, ok .

now you can get result by linq query.


这篇关于如何使用entityframework编写用于显示计数的存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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