I can't insert the login time on my database' specific column (lastlogin
).
I tried to do this but it always show error.
this.Close();
Mainform mainform = new Mainform();
mainform.Show();
MessageBox.Show("Welcome!", "Validation App",
MessageBoxButtons.OK, MessageBoxIcon.Information);
DateTime datetime = DateTime.Now;
string format = "yyyy/MM/dd, HH:mm:ss";
command = new SqlCommand("insert into
dbo.ValidationApp(lastlogin) values(@dtime)", cnn);
command.Parameters.Clear();
command.Parameters.Add("@dtime",datetime.ToString(format));
command.ExecuteNonQuery();
The login time should be inserted on my database but it doesn't.