C # Pass in a time value to determine the day of the month and seconds

Source: Internet
Author: User

Tag: STR service count AST replaces key data ice sel

<summary>
Function: How long a Time field of a table has been updated (compared to the current time of the database)

KeyName: Database Parameters

Bgdataservice.query4datatable: Database connection replaces itself

</summary>
<returns></returns>
public string Resthjstatus (string keyname)
{
String msg = "Run";
String strSQL = "Select cast ((SYSDATE-ZXSJ) *24*60 as int) Minutes from sys_service_execstatue where [email protected]";
DataTable dt = bgdataservice.query4datatable (strSQL, KeyName);
if (dt. Rows.Count = = 0)
{
Return "service not Started";
}
int number = Convert.ToInt32 (dt. rows[0]["Minutes"] = = DBNull.Value? "0": dt. rows[0]["Minutes"]);
TimeSpan ts = new TimeSpan (0, 0, number, 0);
if (TS. Days > 30)
{
Return "service stop time greater than 30 days";
}
if (number >=5)//greater than 5min means stop
{
msg = "Stopped" + TS. Days + "Day" + TS. Hours + "hours" + TS. Minutes + "Minutes";
}
return msg;
}

C # Pass in a time value to determine the day of the month and seconds

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.