vb 对象refresh的方法 iadodc失败 FROM 子句语法错误 新手,快交论文了,大家帮帮我!!
PrivateSubCommand1_Click()DimstrQueryAsStringCommand1.Enabled=TrueCommand2.Enabled=Tr...
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 If
If 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 If
End 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 If
If 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 If
End Sub
Private Sub Command2_Click()
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = True
End Sub
Private Sub Command3_Click()
Unload Me
主界面.Show
End Sub
Private 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 Sub
Private Sub Option1_Click()
Frame3.Visible = True
Frame4.Visible = False
End Sub
Private Sub Option2_Click()
Frame3.Visible = False
Frame4.Visible = True
End Sub
Private 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 If
If 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 If
End 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 If
If 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 If
End Sub
Private Sub Command2_Click()
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = True
End Sub
Private Sub Command3_Click()
Unload Me
主界面.Show
End Sub
Private 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 Sub
Private Sub Option1_Click()
Frame3.Visible = True
Frame4.Visible = False
End Sub
Private Sub Option2_Click()
Frame3.Visible = False
Frame4.Visible = True
End Sub
Private Sub Option3_Click()
Frame3.Visible = False
Frame4.Visible = True
End Sub 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询