日期:2014-05-20  浏览次数:20797 次

Entity Framework如何调用存储过程
请问下Entity Framework怎么调用存储过程,我在实体模型(emdx文件)里创建函数导入mysp_Cursorsc,可是在.Designer.cs

这里找不到mysp_Cursorsc,实例了entity后也点不出mysp_Cursorsc,请问这会是啥原因?怎么才能点出mysp_Cursorsc?

是不是与存储过程有关?

赋上我的存储过程
ALTER PROCEDURE [dbo].[mysp_Cursor]
as
  declare id_cursor cursor for 
  SELECT Tb_company.id FROM Tb_addxinxi JOIN As_addcompanyxinxi ON Tb_addxinxi.id=As_addcompanyxinxi.addxinxiid and Tb_addxinxi.autotime='True' and Tb_addxinxi.del='False' and Tb_addxinxi.date1>getdate() join Tb_company on As_addcompanyxinxi.companyid=Tb_company.id

declare @Field int
open id_cursor 
fetch next from id_cursor into @Field
while(@@fetch_status=0)
begin
  UPDATE Tb_company SET time = getdate() WHERE Tb_company.id = @Field
  fetch next from id_cursor into @Field
end
close id_cursor
deallocate id_cursor


------解决方案--------------------