|
 |
|
ขอรบกวนถามเรื่อง [ASP.NET MVC][DATA FIRST][EntityFramework 6] นะครับ เรื่องการ ใช้งาน Stored procedure โดยมี OUTPUT parameter |
|
 |
|
|
 |
 |
|
โดยปัญหาคือ การ return ค่ากลับของ OUTPUT เป็นค่าว่าง ครับ
บน MSSQL 2012

Code : DBContext
public virtual ObjectResult<SP_GET_REGISTER_Result> SP_GET_REGISTER(Nullable<int> iNDEX_START, Nullable<int> pAGE_SIZE, ObjectParameter rOWSQUERY)
{
var iNDEX_STARTParameter = iNDEX_START.HasValue ?
new ObjectParameter("INDEX_START", iNDEX_START) :
new ObjectParameter("INDEX_START", typeof(int));
var pAGE_SIZEParameter = pAGE_SIZE.HasValue ?
new ObjectParameter("PAGE_SIZE", pAGE_SIZE) :
new ObjectParameter("PAGE_SIZE", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<SP_GET_REGISTER_Result>("SP_GET_REGISTER", iNDEX_STARTParameter, pAGE_SIZEParameter, rOWSQUERY);
}
Code : return with ViewBag
public ActionResult Index()
{
var output = new ObjectParameter("ROWSQUERY", typeof(int));
ViewBag.REGISTER = context.SP_GET_REGISTER(1, 100, output);
ViewBag.GetOut = output.Value;
return View();
}
นั่งแก้นานแล้วยังหาข้อสรุปไม่ได้ครับ..
Tag : .NET, Ms SQL Server 2012, Web (ASP.NET), LINQ, VS 2012 (.NET 4.x)

|
|
 |
 |
 |
 |
Date :
2014-01-23 10:40:55 |
By :
wit_peter |
View :
1137 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ช่วงนี้ใช้ Entity Framework เช่นเดียวกันครับ เขียนง่าย เขียนเร็ว และสนุกมาก ๆ เดียวภายในกลาง ๆ ปีจะทำเป็นบทความซะหน่อย 
|
 |
 |
 |
 |
Date :
2014-01-23 19:39:46 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ครับผม.. ไม่ค่อยมีบทความ ให้ศึกษาเท่าไร [TH] ส่วนปัญหาที่ถาม ผมก็หาทางออกได้แล้วครับ(อาจไม่ใช่วิธีที่ดีที่สุด)(ตามแบบฉบับ Beginner )...แต่ก็พอช่วยได้ จะรอนะครับสำหรับบทความ
|
 |
 |
 |
 |
Date :
2014-01-24 08:54:02 |
By :
wit_peter |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|