I have checkbox and if checkbox checked is true , i want to insert textbox text as datetime(no problem here)However if checkbox checked is not true , i want to give null datetime value.

I don't know how can i give null datetime during inserting data ?

context.SP_INSERT_DATA(MY_CHECKBOX.Checked == true ? Convert.ToDateTime(Textbox.Text) : NULLABLE_value , CustomerID);

Any help will be appreciated.

Thanks.

有帮助吗?

解决方案

context.SP_INSERT_DATA(MY_CHECKBOX.Checked == true ? Convert.ToDateTime(Textbox.Text) : (DateTime?)null , CustomerID);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top