Private void button1_Click_1(object sender, EventArgs e)
{
this.txtinput.MaxLength = 4;
cmd = new OleDbCommand("update Login set Sales_count= IIF(IsNull(Sales_count), 0, Sales_count) + 1 where [Unique_No]=@Unique_No and [To_Date]='#"+DateTime.Now.ToString("dd/MM/yyyy")+"#'", con);
cmd.Parameters.AddWithValue("@Unique_No", txtinput.Text);
con.Open();
int n = cmd.ExecuteNonQuery();
if (n == 0)
{
MessageBox.Show("Invalid Unique No. pls try again later");// **Debugger come to this line if i insert [To_Date]='#"+DateTime.Now.ToString("dd/MM/yyyy")+"#'** // if i remove above line in code then its updating fine
}
else
{
this.DialogResult = DialogResult.OK;
}
con.Close();
}
}