VB5.0中数据库查询模块的实现毕业论文(3)
2015-06-05 02:32
导读:Set my_dr = my_db.OpenRecordset(input) ss1 = select * from input where (物资名称= ' Field_val1 ') Data1.RecordSource = ss1 Data1.Refresh Case 2 若选择供货单位 . . . Case 3 若选择供货日期
Set my_dr = my_db.OpenRecordset("input")
ss1 = "select * from input where (物资名称=" & "'" & Field_val1 & "')"
Data1.RecordSource = ss1
Data1.Refresh
Case 2 ‘若选择“供货单位”
. . .
Case 3 ‘若选择“供货日期”
Field_val3 = Text1.Text
Field_val32 = Text2.Text
If Val(DateDiff("d", (Text1.Text), (Text2.Text))) >= 0 Then
Set my_db = OpenDatabase("d:\zu_vb\in_db.mdb")
Set my_dr = my_db.OpenRecordset("input")
ss1 = "select * from input where 供货日期 between " & "#" _
& Field_val3 & "#" _ & " and " & "#" & Field_val32 & "#" Data1.RecordSource = ss1 Data1.Refresh Else zz = MsgBox("您输入的起始日期比终止日期大,请重新输入!", vbCritical, "严重警告,输入无效!")
End If
Case 4 ‘若选择“到货数量”
Field_val4 = Text1.Text
Field_val42 = Text2.Text
Set my_db = OpenDatabase("d:\zu_vb\in_db.mdb")
Set my_dr = my_db.OpenRecordset("input")
ss1 = "select * from input where 到货数量 between " & Field_val4 _
& " and " & Field_val42
Data1.RecordSource = ss1
Data1.Refresh
Case 5
. . .
End Select
End Sub
Private Sub Command2_Click() ‘取消查询
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command3_Click() ‘ 结束查询
Unload Me
End Sub
大学排名
Private Sub Option1_Click() ‘选定“物资名称”字段
Search_txt = 1
Text1.Text = ""
Label2.Caption = ""
Text2.Enabled = False ‘text2 设为无效
Text2.Visible = False ‘text2 设为不显示
Text1.SetFocus