Hi,
I am using Asp.Net 4, C# and MySQL for a task scanning project. Everything works, except I cannot figure out what to do with the else bit!
I have a text box that takes input from a barcode scanner. When the data is received, a TextChanged event calls the code below:
In the else bit (because the result is 1), we need to evaluate two things using the scanned value:
string sqlB = "SELECT task REGEXP '[0-9]' FROM tasks WHERE task_end IS NULL AND employee_no = '" + this.txtEmployeeNumber.Text + "' AND DATE(task_start) >= CURDATE()-INTERVAL 320 MINUTE;";
If sqlB = 1 then call come code
string sqlC = "SELECT task NOT REGEXP '[0-9]' FROM tasks WHERE task_end IS NULL AND employee_no = '" + this.txtEmployeeNumber.Text + "' AND DATE(task_start) >= CURDATE()-INTERVAL 320 MINUTE;";
If sqlC = 1 then call some code
Any help greatly appreciated!
Thank you.
I am using Asp.Net 4, C# and MySQL for a task scanning project. Everything works, except I cannot figure out what to do with the else bit!
I have a text box that takes input from a barcode scanner. When the data is received, a TextChanged event calls the code below:
Code:
protected void CheckTaskStatus()
{
{
conn.Open();
string sqlA = "SELECT COUNT(task_id) FROM tasks WHERE emp_no = '" + this.txtEmployee.Text + "' AND task_end IS NULL AND DATE(task_start) >= CURDATE()-INTERVAL 320 MINUTE";
MySqlCommand cmd = new MySqlCommand(sqlA, conn);
Int64 mCount = (Int64)cmd.ExecuteScalar();
conn.Close();
if (mCount == 0) //if there is no task assigned to the user, create a new one
{
lblMessage.Text = "<h1>User " + txtEmployeeNumber.Text + " is inactive, let's create a New Task</h1>";
CreateNewJob(); //this works, no problems
}
else
{
[b] //is user has a task, we need to close it here[/b]
}
}
In the else bit (because the result is 1), we need to evaluate two things using the scanned value:
string sqlB = "SELECT task REGEXP '[0-9]' FROM tasks WHERE task_end IS NULL AND employee_no = '" + this.txtEmployeeNumber.Text + "' AND DATE(task_start) >= CURDATE()-INTERVAL 320 MINUTE;";
If sqlB = 1 then call come code
string sqlC = "SELECT task NOT REGEXP '[0-9]' FROM tasks WHERE task_end IS NULL AND employee_no = '" + this.txtEmployeeNumber.Text + "' AND DATE(task_start) >= CURDATE()-INTERVAL 320 MINUTE;";
If sqlC = 1 then call some code
Any help greatly appreciated!
Thank you.