how to Replace null value with 0 Using C#
how to Replace null value with 0 Using C#
//here we suppose that objDataTable have data collection as table now access this //datatable object.
decimal j = 0;
j = objDataTable.Rows[0]["Qty"] == DBNull.Value ? 0 : Convert.ToDecimal(objDataTable.Rows[0]["Qty"]);
NOTE :-
//if DBNull.value is null then "0 " else "your code here")
// ? = then
// : = else
Thank You
[Sumit Singh Shekhawat]
select Isnull(Qty,0) As Qty from Table
ReplyDeleteThanks for showing your smartness, but i'm showing example for only in C#.
ReplyDelete