string Item = Convert.ToString(drr["Item_Code"]);
This Row is not present in the Datatable.So its throw an error.Instead of thrown an erroe i want the (Item ) value is NULL..
Is this Possible without using If Conditon
rhino000 says: string Item = Convert.ToString(drr["Item_Code"]);
string
Item = Convert.ToString(drr[
"Item_Code"
]);
replace above code with below
string Item = drr["Item_Code"] == null ? "NULL" : Convert.ToString(drr["Item_Code"]);
Same error occur
Column 'Item_Code' does not belong to table Table1.
rhino000 says: Same error occur Column 'Item_Code' does not belong to table Table1.
Column
'Item_Code'
does not belong to table Table1.
that means you dont have the column with name Item_Code in your database table.so it will throw error everytime you are trying to access.
Yes..how to assign the NULL value to this Witrhout using If condtion
I have the column in database table .But in c# we did not assign value for that column in this case we can assign the NULL value to that Column in c#
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.