TourEntities db = new TourEntities(); List<v_product> v = new List<v_product>(); SqlParameter[] prams = new SqlParameter[5]; prams[0] = new SqlParameter("@a", 0); prams[1] = new SqlParameter("@b", 0); prams[1].Direction = ParameterDirection.Output; prams[2] = new SqlParameter("@c", 0); prams[3] = new SqlParameter("@d", 0); prams[4] = new SqlParameter("@e", 0); try { v = db.Database.SqlQuery<v_product>("exec dbo.proc_list @a,@b out,@c,@d,@e", prams).ToList(); pageCount = ConvertHelp.ObjToInt(prams[1].Value, 0); } catch (Exception) { }
基本上就是注意一下 ParameterDirection.Output 这个赋值
以及 db.Database.SqlQuery<v_product>("exec dbo.proc_list @a,@b out,@c,@d,@e", prams).ToList();
时间: 2024-12-08 07:54:28