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]
In my example, I have fetch HTML Table Records and Convert to Class List Object for C# Result: Click Here < script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js" ></ script > < script > $ ( document ). ready ( function () { // Get the table element const table = document . getElementsByTagName ( "table" )[ 0 ]; // Get all the table rows const rows = table . rows ; // Create an empty array to store the table data const data = []; // Loop through each row and get the cell data for ( let i = 0 ; i < rows . length ; i ++) { const cells = rows [ i ]. cells ; const rowData = {}; //new Columns { CharacterName = "", Char = "", Code = "", Decimal = "", Binary = "", Hex = "" }, var stringCon = "new Columns {" ; /...
Comments
Post a Comment