我创建了一个库,里面有DATE 销售的日期
现在我想查询哪年哪月哪日的记录 应该怎么查呢?
例如我想要查询2003的记录怎么查呢?
又如要查询2003年5月分的记录应该怎么查呢?
"select * from sell year(date)='" & text1.text & "'"
这样不行啊
现在我想查询哪年哪月哪日的记录 应该怎么查呢?
例如我想要查询2003的记录怎么查呢?
又如要查询2003年5月分的记录应该怎么查呢?
"select * from sell year(date)='" & text1.text & "'"
这样不行啊
哪年哪月"select * from sell where year(date)=2003 and month(date)=5"
Dim mrc As ADODB.Recordset
txtsql = "select * from sell where "
If ComboYear.Text = "" Then
smeg = "请选择年份!"
MsgBox smeg, vbOKOnly + vbExclamation, "警告"
Exit Sub
ComboYear.SetFocus
Else
txtsql = txtsql & "year(销售时间) ='" & ComboYear.Text &"'"
End If
If ComboMonth.Text = "" Then
Else
txtsql = txtsql & "and month(销售时间) ='" & ComboMonth.Text & "'"
End If
If ComboDay.Text = "" Then
Else
txtsql = txtsql & "and day(sell.销售时间)='" & ComboDay.Text & " '"
End If
txtsql = txtsql & " order by 销售编号"
Set mrc = ExecuteSQL(txtsql, msgtext)'这是我定义的数据连接函数 没有问题的