Thanks Marina, partly yes.
But my aim is to reduce the number of DB calls, and do an update only when a
change is detected.
If I have the code the following way,
if (this.HIRE_DT.Text.ToString().Trim() != ""){
oRow["HIRE_DT"] = Convert.ToDatei
Time(this.HIRE_DT.Text.ToString().Trim());
}else{
oRow["HIRE_DT"] = DBNull.Value;
}
Assuming the date in the HIRE_DT textbox was null initially, since i am
setting an explicit DBNull.Value here again, even though the user doesn't do
anything in the UI, the program will set a DBNull.Value and the dataset
detects a change
ie.
ds.HasChanges() will detect a change, and DataViewRowState.ModifiedCurrent
will do an extra DB call.
Thank you,
Yog
"Marina" <so*****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
What are you asking exactly? Howe to set a date field in a dataset to
null?
oRow["HIRE_DT"] = DBNull.Value;
"Yog" <sh******@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl... I am trying to update a date column in dataset from a textbox.
When a date is changed in textbox, the dataset should reflect this,
similarly when the textbox is cleared to null the dataset should reflect
this. This is since i use the "DataViewRowState.ModifiedCurrent" later
to detect the changes for update.
How do we acheive this?.
Currently since i am ignoring nulls, i miss the null condition.
if (this.HIRE_DT.Text.ToString().Trim() != ""){
oRow["HIRE_DT"] =
Convert.ToDateTime(this.HIRE_DT.Text.ToString().Tr im());
}
Thank you,
Yog