Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从OleDB MS access数据库读取数据_C#_Sql_Ms Access - Fatal编程技术网

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参数,是否可以?我不太理解那些代码,因为我还在学习。。。