protected void ButSave_Click(object sender, EventArgs e)
{
if (FileImgsave.HasFile)
{
string imgfile = Path.GetFileName(FileImgsave.PostedFile.FileName);
FileImgsave.PostedFile.SaveAs(Server.MapPath("~/Images/") + imgfile);
sqlCon.Open();
SqlCommand sqlcomm = new SqlCommand("ImageAdd", sqlCon);
sqlcomm.CommandType = CommandType.StoredProcedure;
sqlcomm.Parameters.AddWithValue("@Item", imgfile);
sqlcomm.Parameters.AddWithValue("@Status", statusTb.Text);
sqlcomm.Parameters.AddWithValue("@StartDate", startDateTb.Text);
sqlcomm.Parameters.AddWithValue("@EndDate", endDateTb.Text);
sqlcomm.Parameters.AddWithValue("@ImgPath", "~/Images/" + imgfile);
sqlcomm.Parameters.AddWithValue("@AdvID", advertismentIdTb.Text.Trim());
sqlcomm.Parameters.AddWithValue("@Name", nameTb.Text.Trim());
sqlcomm.ExecuteNonQuery();
// here is the comparing part
if(endDateTb.Text.ToString(DateTime) > startDateTb.Text.ToString(DateTime))
{
}
LitMsg.Text = "Image & Path saved successfully";
SqlCommand sqlCmd1 = new SqlCommand("ShowView", sqlCon);
sqlCmd1.CommandType = CommandType.StoredProcedure;
sqlCmd1.ExecuteNonQuery();
sqlCon.Close();
Clear();
FillGridView();
}else
{
LitMsg.Text = "Please make sure you have a file";
}
}
Hi, how can i compare 2 textbox which contains datetime in asp.net? i tried codes below but theres error. and i cant use endDateTb > startDateTb.