asked on
try
{
connection = new MySqlConnection(source);
command = new MySqlCommand("Select DATEDIFF(TimeIN) - DATEDIFF(TimeOUT) FROM payroll.attendance WHERE Date BETWEEN '" + datefrom.Value.ToString("yyyy-MM-dd") + "' AND '" + dateto.Value.ToString("yyyy-MM-dd") + "' AND EmployeeID='" + lblid.Text + "'", connection);
connection.Open();
MySqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
string diff = reader.GetString("DATEDIFF").ToString();
MessageBox.Show(diff.ToString());
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
ASKER
ASKER
C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).
TRUSTED BY
https://msdn.microsoft.com/en-us/library/ms189794.aspx
The proper form for DATEDIFF is:
Open in new window
In your case it appears as if you want to use something like:Open in new window
-saige-