Private Sub Command1_Click()
Dim strQuery As String
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
d1 = Trim(Text1.Text)
d2 = Trim(Text2.Text)
Adodc1.CommandType = adCmdText
If Option1.Value = True Then
strQuery = "select * from 论文成果 and 发表时间>='" & d1 & "' And 发表时间<= '" & d2 & "'"
End If
If Option2.Value = True Then
strQuery = "select * from 论文成果 where 论文题目='" & Trim(Text3.Text) & "'"
End IfIf Option3.Value Then
strQuery = "select * from 论文成果 where 教师姓名='" & Trim(Text3.Text) & "'"
End If
Adodc1.RecordSource = strQuery
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "不存在此记录!"
End IfEnd Sub
教师姓名和论文题目查询正常,只是时间查询有问题,如果改成20050505这样的话就可以了,日期格式就不行了……
查询好像还要转化数据类型,怎么弄呢? 如果改用DTPicker控件呢?
程序运行先报 FROM 子句语法错误 ,之后弹出vb 对象refresh的方法 iadodc失败
我想实现的是论文的日期区间查询,就是输入2005/5/1 和2011/5/1后中间的数据显示出来。多谢多谢了!!
老师还要求我把查询结果输出,我也不会弄,那位大哥知道请指条明路!!
以下附全部程序
Private Sub Command1_Click()
Dim strQuery As String
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
d1 = Trim(Text1.Text)
d2 = Trim(Text2.Text)
Adodc1.CommandType = adCmdText
If Option1.Value = True Then
strQuery = "select * from 论文成果 and 发表时间>='" & d1 & "' And 发表时间<= '" & d2 & "'"
End If
If Option2.Value = True Then
strQuery = "select * from 论文成果 where 论文题目='" & Trim(Text3.Text) & "'"
End IfIf Option3.Value Then
strQuery = "select * from 论文成果 where 教师姓名='" & Trim(Text3.Text) & "'"
End If
Adodc1.RecordSource = strQuery
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "不存在此记录!"
End IfEnd SubPrivate Sub Command2_Click()
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = True
End SubPrivate Sub Command3_Click()
Unload Me
主界面.Show
End SubPrivate Sub Command4_Click()
Dim SQLstr As String SQLstr = "select * from 论文成果 "
Adodc1.RecordSource = SQLstr
Adodc1.Refresh
Adodc1.Refresh
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\教师业绩.mdb;Persist Security Info=False"
Adodc1.RecordSource = "论文成果"
Adodc1.Refresh
End SubPrivate Sub Option1_Click()
Frame3.Visible = True
Frame4.Visible = False
End SubPrivate Sub Option2_Click()
Frame3.Visible = False
Frame4.Visible = True
End SubPrivate Sub Option3_Click()
Frame3.Visible = False
Frame4.Visible = True
End Sub
Dim strQuery As String
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
d1 = Trim(Text1.Text)
d2 = Trim(Text2.Text)
Adodc1.CommandType = adCmdText
If Option1.Value = True Then
strQuery = "select * from 论文成果 and 发表时间>='" & d1 & "' And 发表时间<= '" & d2 & "'"
End If
If Option2.Value = True Then
strQuery = "select * from 论文成果 where 论文题目='" & Trim(Text3.Text) & "'"
End IfIf Option3.Value Then
strQuery = "select * from 论文成果 where 教师姓名='" & Trim(Text3.Text) & "'"
End If
Adodc1.RecordSource = strQuery
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "不存在此记录!"
End IfEnd Sub
教师姓名和论文题目查询正常,只是时间查询有问题,如果改成20050505这样的话就可以了,日期格式就不行了……
查询好像还要转化数据类型,怎么弄呢? 如果改用DTPicker控件呢?
程序运行先报 FROM 子句语法错误 ,之后弹出vb 对象refresh的方法 iadodc失败
我想实现的是论文的日期区间查询,就是输入2005/5/1 和2011/5/1后中间的数据显示出来。多谢多谢了!!
老师还要求我把查询结果输出,我也不会弄,那位大哥知道请指条明路!!
以下附全部程序
Private Sub Command1_Click()
Dim strQuery As String
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
d1 = Trim(Text1.Text)
d2 = Trim(Text2.Text)
Adodc1.CommandType = adCmdText
If Option1.Value = True Then
strQuery = "select * from 论文成果 and 发表时间>='" & d1 & "' And 发表时间<= '" & d2 & "'"
End If
If Option2.Value = True Then
strQuery = "select * from 论文成果 where 论文题目='" & Trim(Text3.Text) & "'"
End IfIf Option3.Value Then
strQuery = "select * from 论文成果 where 教师姓名='" & Trim(Text3.Text) & "'"
End If
Adodc1.RecordSource = strQuery
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "不存在此记录!"
End IfEnd SubPrivate Sub Command2_Click()
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = True
End SubPrivate Sub Command3_Click()
Unload Me
主界面.Show
End SubPrivate Sub Command4_Click()
Dim SQLstr As String SQLstr = "select * from 论文成果 "
Adodc1.RecordSource = SQLstr
Adodc1.Refresh
Adodc1.Refresh
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\教师业绩.mdb;Persist Security Info=False"
Adodc1.RecordSource = "论文成果"
Adodc1.Refresh
End SubPrivate Sub Option1_Click()
Frame3.Visible = True
Frame4.Visible = False
End SubPrivate Sub Option2_Click()
Frame3.Visible = False
Frame4.Visible = True
End SubPrivate Sub Option3_Click()
Frame3.Visible = False
Frame4.Visible = True
End Sub
解决方案 »
- 如何在 form1 中 设置 回车后 就是 button1.click 点击?
- 菜鸟问题:在FORM窗体中的AutoRedraw属性是什么意思?
- 在 windows server 2003 环境下无法使用 msdn 6,提示不能打开文件
- 各位老大,我想用vb做一个绿色的。。。。。
- 请问如何使用inet控件获得一个ftp站点下所有的文件,并将文件列表放到一个listview中。如何实现?
- 欢迎大家下载我的软件
- 大家帮帮忙拉!!!
- mscomm控件如何向串口发送Ascii值大于128的字符?
- 问listview的一些属性
- VB里面调用IC卡API为什么不行?
- 有关vba的,单元格赋值
- 调用VB资源管理器中添加的文件,释放到具体位置
strQuery = "select * from 论文成果 and 发表时间 between#" & d1 & "# And #" & d2 & "#"
strQuery = "select * from 论文成果 and 发表时间 between #" & d1 & "# And #" & d2 & "#"
strQuery = "select * from 论文成果 where 发表时间 between #" & d1 & "# And #" & d2 & "#"
http://zhidao.baidu.com/question/273368728.html
请在百度也回复下,那里的分也给你们吧,回复加CSDN