Reputation: 969
I am passing data value, to a database, using integer data type (accepting null
).
If in front-end I do not pass any integer it takes null
value in db. While retrieving table data in front-end I am using if
condition to filter the integer empty values. I have only integers to display, how to write the if condition?
int x;
if(x!=(which code this place write)
{
textbox.text=x; //x value not empty working if condition else goto else condition
}
else
{
}
Upvotes: 0
Views: 1238
Reputation: 3365
Not clear from your question but I guess you want to use DBNull
ex:
if(your value == System.DBNull.Value)
Upvotes: 0
Reputation: 39
if you are using Entity Framework ,you could use
if(yourvalue.HasValue){ ...}
Upvotes: 0