Field NULL in date, passing as parameter to the bank

2

I am trying to treat a field in my program to accept data NULL if it is not filled, that field would be CliDtNasc . I did the treatment in the class with the% ter and% in the properties of the treated class to check if the field is if or not, see:

Class:

(!string.IsNullOrEmpty(CliDtNasc) ? new
SqlParameter("@CliDtNasc",DateTime.Parse(CliDtNasc)) : new 
SqlParameter("@CliDtNasc",DBNull.Value))'

Code behind:

if (txtDtNasc.Text.Length > 0)
{

    objCli.CliDtNasc = Convert.ToString(Convert.ToDateTime(txtDtNasc.Text).ToString("yyyy-MM-dd"));

}

Homologation:

I researched the XPTO client that had the date of birth as "03/11/1994". I deleted the date and saved it. Debugging I checked that it does not come as NULL in the field and holds the date. However, when I just modify the date of birth the modifying method works.

    
asked by anonymous 18.04.2017 / 16:51

0 answers