我想使用控制台应用程序并带有小时参数来截断表格。例如,我想在系统时间为12:00 AM时运行截断查询。
以下是我在C#控制台应用程序中的代码:
这不起作用,请给我解决方案或示例代码来解决我的问题。谢谢…
以下是我在C#控制台应用程序中的代码:
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string getHour = DateTime.Now.ToString("h:mm:ss tt");
if (getHour == "12:00:00 AM")
{
Console.WriteLine("Do action to run query truncate");
//in this line i will execute query truncate.
}
// Keep the console window open in debug mode.
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
}
这不起作用,请给我解决方案或示例代码来解决我的问题。谢谢…