我想找出 SQL Server 中两个列之间的区别,它们是仅使用 C# 代码和无 LINQ 的 DataTime 类型。
public class PrintTheQ
{
public DateTime LastStatusUpdate { get; set; }
public DateTime AddedToQueue { get; set; }
}
public static PrintTheQ TestQ ()
{
PrintTheQ TheQ = new PrintTheQ();
string CS = "data source =(local); database = Sample1; Integrated Security=SSPI";
using (SqlConnection connection = new SqlConnection(CS))
{
connection.Open();
SqlCommand command = new SqlCommand("select *from TelecomTable WHERE AddedToQueue >= DATEADD (day, -2, GetDate()) ", connection);
using (SqlDataReader reader = command.ExecuteReader())
{
TheQ.AddedToQueue = Convert.ToDateTime((reader, "AddedToQueue"));
TheQ.LastStatusUpdate = Convert.ToDateTime((reader, "LastStatusUpdate"));
}
}
return TheQ;
}
隔江千里
德玛西亚99
相关分类