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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Posted Jul 28, 2013, 9:10 PM EDT
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.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 28, 2013, 8:10 PM EDT
try like this
dtpPurchaseDate.Text=inforPurchase.puchaseDate.ToShortDateString();
Regards,
Iftikar
Sunny SharmaRank #223 · 11.1K reputationPosted Jul 28, 2013, 8:57 PM EDT
Show me your code.
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 28, 2013, 9:12 PM EDT
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.
Bineesh ViswanathRank #1,681 · 907 reputationPosted Jul 28, 2013, 11:40 PM EDT