C# 从OleDB MS access数据库读取数据
谁能指导我如何从数据库中读取数据 这是我的一些代码C# 从OleDB MS access数据库读取数据,c#,sql,ms-access,C#,Sql,Ms Access,谁能指导我如何从数据库中读取数据 这是我的一些代码 oda = new OleDbDataAdapter("Select * from userdetails where date <='"+DateTime.Now+"'", cn); oda.Fill(dt); if (dt.Rows.Count == 3) { MessageBox.Show("You have notification on due date"); } 仅当my userdetails表中的日期数据小于
oda = new OleDbDataAdapter("Select * from userdetails where date <='"+DateTime.Now+"'", cn);
oda.Fill(dt);
if (dt.Rows.Count == 3)
{
MessageBox.Show("You have notification on due date");
}
仅当my userdetails表中的日期数据小于或等于当前日期时,上述代码才会弹出消息框。那么,我怎样才能做出更合理的决定,比如提前3天通知用户。有人能指导我吗?将DateTime类型转换为SQL DateTime类型。使用SqlCommand参数如果我使用MS Access作为数据库并放置SqlCommand参数,是否可以?我不太理解那些代码,因为我还在学习。。。