if 문에 =,>, & &과 같은 연산자를 사용하고 싶습니다. 이 조건이 true 일 때만 전자 메일을 보내려고합니다 (strAuthReqDate == null & & strDate < strExpectedSubDate). 그래서 내 "미만의 운영자"잘못 pls 내가 여기에 잘못하고있는 일을 알려주라고 생각합니다.C#을 사용하는 If 문에서 둘 이상의 연산자를 사용하는 방법
foreach (GridViewRow gr in GridView1.Rows)
{
CheckBox cb = (CheckBox)gr.FindControl("chkItem");
if (cb.Checked)
{
// string strID = gr.Cells[0].Text;
string strExpectedSubDate = gr.Cells[3].Text;
string strAuthReqDate = gr.Cells[8].Text;
string strDate = Convert.ToString(System.DateTime.Now);
if (strAuthReqDate == null && strDate < strExpectedSubDate)
{
send email();
}
}
}
괜찮아 보입니다. 문제 시체는 무엇입니까? – Rikki
날짜 비교가 아닌 문자열 비교를 수행하고 있습니다. 'strExpectedSubDate' 형식은 어떤 형식입니까? –
두 필드는 모두 날짜 필드입니다. 모하메드에게 몇 가지 예를 보여 주시겠습니까? – moe