Object reference not set to an instance of an object.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.NullReferenceException: Object reference not set to an instance of an object.Source Error: Line 50: txt_OrderId.Text = listOrder.Order_Id.ToString(); Line 51: Line 52: txt_Amount.Text = Convert.IsDBNull(listOrder.Final_Amount)?"" : listOrder.Amount.ToString(); Line 53: //Response.Write(listOrder.Amount); Line 54: //txt_FinalAmount.Text =listOrder.Final_Amount.ToString();
Object reference not set to an instance of an object.
而且我加上这个 同样报 Object reference not set to an instance of an object. txt_Amount.Text = temp;
重新生成解决方案试试,我怀疑是designer的问题
from u in Users select new{a=Convert.IsDBNull(u.IsSeniorClaimOfficer)?false:u.IsSeniorClaimOfficer}SELECT [t0].[IsSeniorClaimOfficer] AS [value], CONVERT(Int,[t0].[IsSeniorClaimOfficer]) AS [value2] FROM [Users] AS [t0]=================================== from u in Users select new{a=u.IsSeniorClaimOfficer==null?false:u.IsSeniorClaimOfficer}SELECT (CASE WHEN [t0].[IsSeniorClaimOfficer] IS NULL THEN @p0 ELSE CONVERT(Int,[t0].[IsSeniorClaimOfficer]) END) AS [a] FROM [Users] AS [t0]============================from u in Users select new{a=u.IsSeniorClaimOfficer??false}-- Region Parameters DECLARE @p0 Int = 0 -- EndRegion SELECT COALESCE([t0].[IsSeniorClaimOfficer],@p0) AS [a] FROM [Users] AS [t0]============= 试了几个 翻译成的SQL语句中都没见到ISNULL() 明天再来找找看
string temp = BNull.Value==listOrder.Final_Amount ?"":listOrder.Final_Amount.ToString();
Object reference not set to an instance of an object.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.NullReferenceException: Object reference not set to an instance of an object.Source Error:
Line 50: txt_OrderId.Text = listOrder.Order_Id.ToString();
Line 51:
Line 52: txt_Amount.Text = Convert.IsDBNull(listOrder.Final_Amount)?"" : listOrder.Amount.ToString();
Line 53: //Response.Write(listOrder.Amount);
Line 54: //txt_FinalAmount.Text =listOrder.Final_Amount.ToString();
Object reference not set to an instance of an object.
txt_Amount.Text = temp;
from u in Users
select new{a=Convert.IsDBNull(u.IsSeniorClaimOfficer)?false:u.IsSeniorClaimOfficer}SELECT [t0].[IsSeniorClaimOfficer] AS [value], CONVERT(Int,[t0].[IsSeniorClaimOfficer]) AS [value2]
FROM [Users] AS [t0]===================================
from u in Users
select new{a=u.IsSeniorClaimOfficer==null?false:u.IsSeniorClaimOfficer}SELECT
(CASE
WHEN [t0].[IsSeniorClaimOfficer] IS NULL THEN @p0
ELSE CONVERT(Int,[t0].[IsSeniorClaimOfficer])
END) AS [a]
FROM [Users] AS [t0]============================from u in Users
select new{a=u.IsSeniorClaimOfficer??false}-- Region Parameters
DECLARE @p0 Int = 0
-- EndRegion
SELECT COALESCE([t0].[IsSeniorClaimOfficer],@p0) AS [a]
FROM [Users] AS [t0]=============
试了几个 翻译成的SQL语句中都没见到ISNULL()
明天再来找找看
你 Rebuild 试一下从你现在的描述 判断不了是什么造成 txt_Amount 为 null 了
感谢各位了。谢谢版主