TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sofari Agali
1.5k
276
26.2k
String was not recognized as a valid DateTime
May 12 2020 6:27 AM
Hi!
Someone to help me for this ; I have the following code in my project:
public
void
LoadRecords()
{
int
i = 0;
dataGridView1.Rows.Clear();
cn.Open();
cm =
new
OleDbCommand(
"select * from Produit"
, cn);
dr = cm.ExecuteReader();
while
(dr.Read())
{
i += 1;
dataGridView1.Rows.Add(i, dr[
"ProdID"
].ToString(), dr[
"nom"
].ToString(), dr[
"Quantite"
].ToString(), dr[
"peremption"
].ToString());
foreach
(DataGridViewRow row
in
dataGridView1.Rows)
{
var now = DateTime.npw;
var expireDate = DateTime.Parse(row.Cells[3].Value.ToString());
var sixtyDayBefore = expireDate.AddDays(-1);
if
(now > sixtyDayBefore && now > expireDate)
{
row.DefaultCellStyle.BackColor = Color.Yellow;
}
else
if
(now > expireDate)
{
row.DefaultCellStyle.BackColor = Color.Red;
}
}
}
cn.Close();
dr.Close();
}
Reply
Answers (
3
)
Create a word File when the console application start
How to use HTML tags in word using console application