My task is Update function.
see the form where I do the cellDoubleClick function of dataGridview.
and I am getting this error:-
please help me in this topic.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted Jul 29, 2013, 1:10 AM
It looks like, you're not getting the date value from the datagridview row. Before assigning into the date control, do null check, then convert into short and assign into the date control.
if (inforPurchase.puchaseDate!= null && inforPurchase.puchaseDate != DateTime.MinValue)
{
dtpPurchaseDate.Text=inforPurchase.puchaseDate.ToShortDateString();
}
Hope this helps you.
Bineesh ViswanathPosted Jul 29, 2013, 3:40 AM
Ravi ShekharPosted Jul 29, 2013, 1:12 AM
dtpPurchaseDate.Text=Convert.ToDateTime(inforPurchase.puchaseDate.ToString())
Now check your date format in dtpPurchaseDate.Text and match this one with your sql table date format.
share your code here for more.
Sunny SharmaPosted Jul 29, 2013, 12:57 AM
Show me your code.
Iftikar HussainPosted Jul 29, 2013, 12:10 AM
try like this
dtpPurchaseDate.Text=inforPurchase.puchaseDate.ToShortDateString();
Regards,
Iftikar