genesix
New member
- Joined
- Jul 27, 2024
- Messages
- 2
- Programming Experience
- 1-3
Hi,
I just want to let you know that I am not a well-verse programmer that is why I am seeking help. I really hope that someone will help me. THANK YOU.
My question is how can I validate the dates column in my SQL stable.
The validation should be IF THE DATE.NOW is not equal today then it will insert a record. It found the DATE.NOW is equal then it will just do nothing.
Try
con.ConnectionString = "Data Source=PHHWNELABIO01\SQL2019; Initial Catalog=biometric; User ID=sa; Password=Test1234;"
con.Open()
cmd.Connection = con
'If MessageBox.Show("Do you want To Continue Logging In?", "VISUAL Timesheet", MessageBoxButtons.YesNo) = DialogResult.No Then
Else
cmd = New SqlCommand("insert into timesheet ([ID], [empNo], [empName], [shift], [login], [dates]) values ('" & TextBox2.Text & "','" & TextBox1.Text & "','" & ComboBox1.Text & "','" & ComboBox2.Text & "','" & DateTimePicker1.Value.ToString("MMMM dd, yyyy hh:mm:ss") & "','" & Date.Now & "')", con)
cmd.ExecuteNonQuery()
MessageBox.Show("Successfully Clock-In")
Catch ex As Exception
Finally
con.Close()
End Try
'End If
I just want to let you know that I am not a well-verse programmer that is why I am seeking help. I really hope that someone will help me. THANK YOU.
My question is how can I validate the dates column in my SQL stable.
The validation should be IF THE DATE.NOW is not equal today then it will insert a record. It found the DATE.NOW is equal then it will just do nothing.
Try
con.ConnectionString = "Data Source=PHHWNELABIO01\SQL2019; Initial Catalog=biometric; User ID=sa; Password=Test1234;"
con.Open()
cmd.Connection = con
'If MessageBox.Show("Do you want To Continue Logging In?", "VISUAL Timesheet", MessageBoxButtons.YesNo) = DialogResult.No Then
Else
cmd = New SqlCommand("insert into timesheet ([ID], [empNo], [empName], [shift], [login], [dates]) values ('" & TextBox2.Text & "','" & TextBox1.Text & "','" & ComboBox1.Text & "','" & ComboBox2.Text & "','" & DateTimePicker1.Value.ToString("MMMM dd, yyyy hh:mm:ss") & "','" & Date.Now & "')", con)
cmd.ExecuteNonQuery()
MessageBox.Show("Successfully Clock-In")
Catch ex As Exception
Finally
con.Close()
End Try
'End If