Quote:
I'm hoping to get help with the system to automatically detect the 2nd scan of a person to be an OUT scan.
You already have a solution, but not automatic. You have to device a way to deduce if scan is in or out.
Solution can be user doing input as it scan, or deducing in/put with even/odd passage. But it also depend on actual conditions of working like plant running 7/24 or not and employee working less than 12h per day.
Solution also depend on scans being accurate or not, you may need a procedure to recover inconsistent scans.
All this depend on exact details on how the plant operates. We can't do it for you.
com = new SqlCommand("insert into log(tag,emp,name,intime,tarikh,dep) values ('" + textBox3.Text + "','" + textBox2.Text + "','" + textBox4.Text + "','" + textBox7.Text + "','" + textBox6.Text + "','" + textBox5.Text + "')", con);
Not a solution to your question, but another problem you have.
Never build an SQL query by concatenating strings. Sooner or later, you will do it with user inputs, and this opens door to a vulnerability named "SQL injection", it is dangerous for your database and error prone.
A single quote in a name and your program crash. If a user input a name like "Brian O'Conner" can crash your app, it is an SQL injection vulnerability, and the crash is the least of the problems, a malicious user input and it is promoted to SQL commands with all credentials.
SQL injection - Wikipedia[
^]
SQL Injection[
^]
SQL Injection Attacks by Example[
^]
PHP: SQL Injection - Manual[
^]
How can I explain SQL injection without technical jargon? - Information Security Stack Exchange[
^]