Fathy Geaiessah

Fathy Geaiessah

  • NA
  • 17
  • 11.9k

Insert null value using limq to sql

Oct 17 2013 4:48 AM

Hi every body

I am trying to insert values using linq to sql through textboxes some of these textboxes may contain null values how to insert null values without exception, for example:

{

tblUser u=new tblUser;

u.Name=txt1.text;

u.Mobile=txt2.text;

db.tblUsers.InsertOnSubmit(u);

db.SubmitChanges();
}

if txt1 or txt2 is empty how to avoid exception and insert the null value?

 


Answers (1)