数据库查询问题。在线等!

asdefwang 2004-05-08 11:52:28
我做了一段查询程序,现在想加入时间查询,不知道怎么加,请高手赐教,我用的 是framel,我在里面加入时间文本框,入年,月,日。然后在里面写入我想查询的时间,同时
三个合同号and班组and时间相于查询。下面程序是我的合同号和班组两个相于查询。
Dim Gconn As New ADODB.Connection
Dim RsField As ADODB.Recordset
Dim MaTable As String
Dim Num As Long
Dim BaseConn As String
Dim ChaineConn As String


Private Sub cnd1_Click()

dbString = App.Path & "\" & Trim(t1) & ".mdb"
If Dir(dbString) = "" Then
MsgBox "ºÏͬºÅÊäÈë´íÎó£¬ÇëÖØÊÔ", vbInformation, "ad"
Exit Sub
End If

Dim lstrSQL As String

Dim aa As String
listview1.ListItems.Clear

lstrSQL = "" '¶¨ÒåÊý¾Ý¿âºÍ°à×é²éѯ
aa = "" '¶¨ÒåÊý¾Ý¿âÃû×Ö²éѯ
lstrSQL = lstrSQL & "select productinf.*,pipes.* From productinf,pipes "
aa = aa & "select productinf.*,pipes.* From productinf,pipes "

If Trim(c1) = "ËùÓÐ" Then
lstrSQL = aa & "Where (ProductInf.ºÏͬºÅ = '" & t1.Text & "' ) And Pipes.ID=ProductInf.ID"
Else
lstrSQL = aa & "Where (ProductInf.ºÏͬºÅ = '" & t1.Text & "') And (Pipes.°à×é = '" & c1.Text & "') And Pipes.ID=ProductInf.ID"
End If
...全文
46 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
asdefwang 2004-05-08
  • 打赏
  • 举报
回复
还有其他方法吗?我用的是framel框里面有 年用textbox.月和日用combobox做的,我查询时要同时满足合同号,班组,时间三个条件的,请教
hslyliu 2004-05-08
  • 打赏
  • 举报
回复
sqlstr="select * from table where date=#" + 年 + "-" + 月 + "-" + 日 + "#"

7,714

社区成员

发帖
与我相关
我的任务
社区描述
Microsoft Office Access是由微软发布的关系数据库管理系统。它结合了 MicrosoftJet Database Engine 和 图形用户界面两项特点。
社区管理员
  • Access
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧