Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,037

HOME > .NET Framework > Forum > ช่วยผมด้วย An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.



 

ช่วยผมด้วย An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

 



Topic : 064298

Guest




Server Error in '/' Application.
--------------------------------------------------------------------------------

Incorrect syntax near ')'.
Incorrect syntax near ')'.

WITH TempTaskJob AS
(
SELECT ROW_NUMBER() OVER ( ORDER BY a.[Update_Date] DESC ,a.[RECEIVE_DATE] DESC ) AS RowNumber
,a.[JOB_ID] ,a.[MLST_ID] ,a.[DOC_NO]
,a.[SUBJECT] ,a.[DESCRIPTION] ,a.[INST_ID]
,d.[INST_NAME] ,a.[RECEIVE_DATE] ,a.[ALLOW_TO_EDIT]
,a.[ALLOW_TO_VISIBLE] ,a.[STEP_SEQ] ,a.[ACTLST_SEQ]
,a.[STATUS] ,a.[REF] ,a.[LOCK]
,a.[LOCK_BY] ,a.[Job_Status] ,'' AS LOCK_NAME
,a.[USERGROUP_ID] ,a.[DEP_ID] ,a.[nYear]
,a.[Entry_Date] ,a.[Entry_User] ,a.[Update_Date]
,a.[Update_user] ,b.FullName AS Entry_Name
,c.FullName AS Update_Name ,t1.JobStatus_name
,a.[OWNER_ID] ,t2.FullName AS Owner_name
,a.[Has_Attach] ,a.[Job_Day]
,a.[Finish_date] ,a.[Content_count]
, Min_End_date = (SELECT MIN(aa.[End_date])FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id] )
, Max_Alert = (SELECT MAX(aa.[Alertbef_due]) FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id]
AND aa.[End_date] = (SELECT MIN(aa.[End_date])FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id] ))

FROM [dbo].[TrnJob] AS a WITH(NOLOCK)LEFT OUTER JOIN
dbo.View_UserInfo AS b ON b.[User_id] = a.[Entry_User] LEFT OUTER JOIN
dbo.View_UserInfo AS c ON c.[User_id] = a.[Update_user] INNER JOIN
dbo.MasInstitute AS d ON d.[INST_ID] = a.[INST_ID] INNER JOIN
dbo.MasJobStatus AS t1 ON t1.JobStatus_id = a.Status LEFT OUTER JOIN
dbo.View_UserInfo AS t2 ON t2.[User_id] = a.[OWNER_ID] WHERE a.[Job_Status] = 1 And a.[DEP_ID] = 1 And (a.[UserGroup_id] = 0 Or a.[UserGroup_id] = ) And (a.[Entry_User]= 109)
)
SELECT *
FROM TempTaskJob
WHERE RowNumber > 0 AND RowNumber < 6
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near ')'.
Incorrect syntax near ')'.

WITH TempTaskJob AS
(
SELECT ROW_NUMBER() OVER ( ORDER BY a.[Update_Date] DESC ,a.[RECEIVE_DATE] DESC ) AS RowNumber
,a.[JOB_ID] ,a.[MLST_ID] ,a.[DOC_NO]
,a.[SUBJECT] ,a.[DESCRIPTION] ,a.[INST_ID]
,d.[INST_NAME] ,a.[RECEIVE_DATE] ,a.[ALLOW_TO_EDIT]
,a.[ALLOW_TO_VISIBLE] ,a.[STEP_SEQ] ,a.[ACTLST_SEQ]
,a.[STATUS] ,a.[REF] ,a.[LOCK]
,a.[LOCK_BY] ,a.[Job_Status] ,'' AS LOCK_NAME
,a.[USERGROUP_ID] ,a.[DEP_ID] ,a.[nYear]
,a.[Entry_Date] ,a.[Entry_User] ,a.[Update_Date]
,a.[Update_user] ,b.FullName AS Entry_Name
,c.FullName AS Update_Name ,t1.JobStatus_name
,a.[OWNER_ID] ,t2.FullName AS Owner_name
,a.[Has_Attach] ,a.[Job_Day]
,a.[Finish_date] ,a.[Content_count]
, Min_End_date = (SELECT MIN(aa.[End_date])FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id] )
, Max_Alert = (SELECT MAX(aa.[Alertbef_due]) FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id]
AND aa.[End_date] = (SELECT MIN(aa.[End_date])FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id] ))

FROM [dbo].[TrnJob] AS a WITH(NOLOCK)LEFT OUTER JOIN
dbo.View_UserInfo AS b ON b.[User_id] = a.[Entry_User] LEFT OUTER JOIN
dbo.View_UserInfo AS c ON c.[User_id] = a.[Update_user] INNER JOIN
dbo.MasInstitute AS d ON d.[INST_ID] = a.[INST_ID] INNER JOIN
dbo.MasJobStatus AS t1 ON t1.JobStatus_id = a.Status LEFT OUTER JOIN
dbo.View_UserInfo AS t2 ON t2.[User_id] = a.[OWNER_ID] WHERE a.[Job_Status] = 1 And a.[DEP_ID] = 1 And (a.[UserGroup_id] = 0 Or a.[UserGroup_id] = ) And (a.[Entry_User]= 109)
)
SELECT *
FROM TempTaskJob
WHERE RowNumber > 0 AND RowNumber < 6

Source Error:


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SqlException (0x80131904): Incorrect syntax near ')'.
Incorrect syntax near ')'.

WITH TempTaskJob AS
(
SELECT ROW_NUMBER() OVER ( ORDER BY a.[Update_Date] DESC ,a.[RECEIVE_DATE] DESC ) AS RowNumber
,a.[JOB_ID] ,a.[MLST_ID] ,a.[DOC_NO]
,a.[SUBJECT] ,a.[DESCRIPTION] ,a.[INST_ID]
,d.[INST_NAME] ,a.[RECEIVE_DATE] ,a.[ALLOW_TO_EDIT]
,a.[ALLOW_TO_VISIBLE] ,a.[STEP_SEQ] ,a.[ACTLST_SEQ]
,a.[STATUS] ,a.[REF] ,a.[LOCK]
,a.[LOCK_BY] ,a.[Job_Status] ,'' AS LOCK_NAME
,a.[USERGROUP_ID] ,a.[DEP_ID] ,a.[nYear]
,a.[Entry_Date] ,a.[Entry_User] ,a.[Update_Date]
,a.[Update_user] ,b.FullName AS Entry_Name
,c.FullName AS Update_Name ,t1.JobStatus_name
,a.[OWNER_ID] ,t2.FullName AS Owner_name
,a.[Has_Attach] ,a.[Job_Day]
,a.[Finish_date] ,a.[Content_count]
, Min_End_date = (SELECT MIN(aa.[End_date])FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id] )
, Max_Alert = (SELECT MAX(aa.[Alertbef_due]) FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id]
AND aa.[End_date] = (SELECT MIN(aa.[End_date])FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id] ))

FROM [dbo].[TrnJob] AS a WITH(NOLOCK)LEFT OUTER JOIN
dbo.View_UserInfo AS b ON b.[User_id] = a.[Entry_User] LEFT OUTER JOIN
dbo.View_UserInfo AS c ON c.[User_id] = a.[Update_user] INNER JOIN
dbo.MasInstitute AS d ON d.[INST_ID] = a.[INST_ID] INNER JOIN
dbo.MasJobStatus AS t1 ON t1.JobStatus_id = a.Status LEFT OUTER JOIN
dbo.View_UserInfo AS t2 ON t2.[User_id] = a.[OWNER_ID] WHERE a.[Job_Status] = 1 And a.[DEP_ID] = 1 And (a.[UserGroup_id] = 0 Or a.[UserGroup_id] = ) And (a.[Entry_User]= 109)
)
SELECT *
FROM TempTaskJob
WHERE RowNumber > 0 AND RowNumber < 6]
SPMLib.DAL.SqlClient.TrnJobSqlClient.ListDashboard_Admin(Int32 PageSize, Int32 CurrentPage, String user_query) in D:\SPM_SRC\SPM\SPM Project\SPMLib\DAL\SqlClient\.Trn\TrnJobSqlClient.cs:399
SpmWeb.UserControl.Dashboard.Document_admin.BindingData() in D:\SPM_SRC\SPM\SPM Project\SPM Web\UserControl\Dashboard\Document_admin.ascx.cs:51
SpmWeb._Default.VerifyDashboard() in D:\SPM_SRC\SPM\SPM Project\SPM Web\Default.aspx.cs:46
SpmWeb._Default.Page_Load(Object sender, EventArgs e) in D:\SPM_SRC\SPM\SPM Project\SPM Web\Default.aspx.cs:24
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433



Tag : .NET, Ms SQL Server 2005, Web (ASP.NET), C#, VS 2008 (.NET 3.x)







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-08-05 10:01:56 By : DK View : 2185 Reply : 3
 

 

No. 1



โพสกระทู้ ( 1,348 )
บทความ ( 1 )



สถานะออฟไลน์


1. ลองทดสอบ SQL บน SQL Server Management Studio (SSMS) หรือยัง???

2. เกี่ยวกับการใช้ Common Table Expression (CTE) ลักษณะนี้
Code
WITH TempTaskJob AS
(
SELECT ROW_NUMBER() OVER ( ORDER BY a.[Update_Date] DESC ,a.[RECEIVE_DATE] DESC ) AS RowNumber
,a.[JOB_ID] ,a.[MLST_ID] ,a.[DOC_NO]
,a.[SUBJECT] ,a.[DESCRIPTION] ,a.[INST_ID]
,d.[INST_NAME] ,a.[RECEIVE_DATE] ,a.[ALLOW_TO_EDIT]
,a.[ALLOW_TO_VISIBLE] ,a.[STEP_SEQ] ,a.[ACTLST_SEQ]
,a.[STATUS] ,a.[REF] ,a.[LOCK]
,a.[LOCK_BY] ,a.[Job_Status] ,'' AS LOCK_NAME
,a.[USERGROUP_ID] ,a.[DEP_ID] ,a.[nYear]
,a.[Entry_Date] ,a.[Entry_User] ,a.[Update_Date]
,a.[Update_user] ,b.FullName AS Entry_Name
,c.FullName AS Update_Name ,t1.JobStatus_name
,a.[OWNER_ID] ,t2.FullName AS Owner_name
,a.[Has_Attach] ,a.[Job_Day]
,a.[Finish_date] ,a.[Content_count]
, Min_End_date = (SELECT MIN(aa.[End_date])FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id] )
, Max_Alert = (SELECT MAX(aa.[Alertbef_due]) FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id]
AND aa.[End_date] = (SELECT MIN(aa.[End_date])FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id] ))

FROM [dbo].[TrnJob] AS a WITH(NOLOCK)LEFT OUTER JOIN
dbo.View_UserInfo AS b ON b.[User_id] = a.[Entry_User] LEFT OUTER JOIN
dbo.View_UserInfo AS c ON c.[User_id] = a.[Update_user] INNER JOIN
dbo.MasInstitute AS d ON d.[INST_ID] = a.[INST_ID] INNER JOIN
dbo.MasJobStatus AS t1 ON t1.JobStatus_id = a.Status LEFT OUTER JOIN
dbo.View_UserInfo AS t2 ON t2.[User_id] = a.[OWNER_ID] WHERE a.[Job_Status] = 1 And a.[DEP_ID] = 1 And (a.[UserGroup_id] = 0 Or a.[UserGroup_id] = ) And (a.[Entry_User]= 109)
)
SELECT *
FROM TempTaskJob
WHERE RowNumber > 0 AND RowNumber < 6


ผมว่าใช้ TOP ดีกว่านะครับ
Code
SELECT TOP 5 a.[JOB_ID] ,a.[MLST_ID] ,a.[DOC_NO]
,a.[SUBJECT] ,a.[DESCRIPTION] ,a.[INST_ID]
,d.[INST_NAME] ,a.[RECEIVE_DATE] ,a.[ALLOW_TO_EDIT]
,a.[ALLOW_TO_VISIBLE] ,a.[STEP_SEQ] ,a.[ACTLST_SEQ]
,a.[STATUS] ,a.[REF] ,a.[LOCK]
,a.[LOCK_BY] ,a.[Job_Status] ,'' AS LOCK_NAME
,a.[USERGROUP_ID] ,a.[DEP_ID] ,a.[nYear]
,a.[Entry_Date] ,a.[Entry_User] ,a.[Update_Date]
,a.[Update_user] ,b.FullName AS Entry_Name
,c.FullName AS Update_Name ,t1.JobStatus_name
,a.[OWNER_ID] ,t2.FullName AS Owner_name
,a.[Has_Attach] ,a.[Job_Day]
,a.[Finish_date] ,a.[Content_count]
, Min_End_date = (SELECT MIN(aa.[End_date])FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id] )
, Max_Alert = (SELECT MAX(aa.[Alertbef_due]) FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id]
AND aa.[End_date] = (SELECT MIN(aa.[End_date])FROM [TrnTracking] AS aa WHERE aa.[FINISH_DATE] IS NULL AND aa.[Job_id] = a.[Job_id] ))

FROM [dbo].[TrnJob] AS a WITH(NOLOCK)LEFT OUTER JOIN
dbo.View_UserInfo AS b ON b.[User_id] = a.[Entry_User] LEFT OUTER JOIN
dbo.View_UserInfo AS c ON c.[User_id] = a.[Update_user] INNER JOIN
dbo.MasInstitute AS d ON d.[INST_ID] = a.[INST_ID] INNER JOIN
dbo.MasJobStatus AS t1 ON t1.JobStatus_id = a.Status LEFT OUTER JOIN
dbo.View_UserInfo AS t2 ON t2.[User_id] = a.[OWNER_ID] WHERE a.[Job_Status] = 1 And a.[DEP_ID] = 1 And (a.[UserGroup_id] = 0 Or a.[UserGroup_id] = ) And (a.[Entry_User]= 109)

ORDER BY a.[Update_Date] DESC ,a.[RECEIVE_DATE] DESC


น่าจะทำให้ Performance ดีขึ้น






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-08-05 10:14:29 By : watcharop
 


 

No. 2

Guest


ขอบคุณครับ จะลองดูครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-08-05 10:59:18 By : DK
 

 

No. 3

Guest


แต่ผมติดปัญหานี้อยู่ที่ว่า code มันอยู่ตรงไหน เพราะผมไม่ได้เขียนเอง เขาให้ผมมาแก้ TT
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-08-05 11:04:09 By : DK
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยผมด้วย An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่