c# - linq check if matches null or selected item -


i checking see if items match whats in mssql db. using linq update records. know how can check if item equal d_0_2 or if equal null/empty. how go doing this?

below existing code, partially works. failing due null/empty

 if (updateproduct.studioid == convert.toint32(d_0_2.selectedvalue)) { }  else { updateproduct.studioid = convert.toint32(d_0_2.selectedvalue);} 

thanks in advance.

string value = d_0_2.selectedvalue.tostring(); // if selectedvalue empty or null? if (!string.isnullorempty(value))     return; // if product null? if (updateproduct != null)     return;  if (updateproduct.studioid != null &&     updateproduct.studioid == convert.toint32(value)) {     // have product , id equal d_0_2.selectedvalue } else {     // studioid not equal to d_0_2.selectedvalue     updateproduct.studioid = convert.toint32(value); } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -