Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Combo2.Text = ""
Text7.Text = ""
Text8.Text = ""
Combo1.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
End Sub
Private Sub Command2_Click()
Dim XueHao, XingMing, NianJi, ZhuanY, XingBie, MZ, JG, ZZMM, JTDZ, YZBM, LXDH, BZ As String
Dim n As Integer
XueHao = Text1.Text
XingMing = Text2.Text
NianJi = Text3.Text
ZhuanY = Text4.Text
XingBie = Combo2.Text
MZ = Text7.Text
JG = Text8.Text
ZZMM = Combo1.Text
JTDZ = Text9.Text
YZBM = Text10.Text
LXDH = Text11.Text
BZ = Text12.Text
If Trim(XueHao) = "" Or Trim(XingMing) = "" Or Trim(NianJi) = "" Or Trim(XingBie) = "" Or Trim(MZ) = "" Or Trim(JG) = "" Or Trim(ZZMM) = "" Or Trim(JTDZ) = "" Or Trim(YZBM) = "" Or Trim(LXDH) = "" Then
MsgBox "请填写要删除的资料!"
Exit Sub
End If
If myCon.State = 1 Then
myCon.Close
End If
myCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=信息.mdb;"
myRs.Open "select * from 学生档案 where 学号='" & Text1.Text & "'", myCon, 3, 2
n = MsgBox("您确定要删除吗?", vbYesNo, "提示")
If n = 6 Then
MsgBox ("删除成功!")
myRs.Delete
myRs.Close
myCon.Close
End If
Adodc1.RecordSource = "select * from 学生档案 order by 学号"
Frm_AddDangA.Adodc1.Refresh
Frm_AddDangA.DataGrid1.Refresh
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Combo2.Text = ""
Text7.Text = ""
Text8.Text = ""
Combo1.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub DataGrid1_Click()
Frm_AddDangA.Adodc1.RecordSource = "select * from 学生档案 where 学号 = '" & Trim(DataGrid1.Row) & "'"
Text1.Text = Frm_AddDangA.Adodc1.Recordset.Fields("学号")
Text2.Text = Frm_AddDangA.Adodc1.Recordset.Fields("姓名")
Text3.Text = Frm_AddDangA.Adodc1.Recordset.Fields("年级")
Text4.Text = Frm_AddDangA.Adodc1.Recordset.Fields("专业")
Combo2.Text = Frm_AddDangA.Adodc1.Recordset.Fields("性别")
Text7.Text = Frm_AddDangA.Adodc1.Recordset.Fields("民族")
Text8.Text = Frm_AddDangA.Adodc1.Recordset.Fields("籍贯")
Combo1.Text = Frm_AddDangA.Adodc1.Recordset.Fields("政治面貌")
Text9.Text = Frm_AddDangA.Adodc1.Recordset.Fields("家庭地址")
Text10.Text = Frm_AddDangA.Adodc1.Recordset.Fields("邮政编码")
Text11.Text = Frm_AddDangA.Adodc1.Recordset.Fields("联系电话")
Text12.Text = Frm_AddDangA.Adodc1.Recordset.Fields("备注")
Command2.Enabled = True
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=信息.mdb;Persist Security Info=False"
Combo2.AddItem ("男")
Combo2.AddItem ("女")
Combo1.AddItem ("团员")
Combo1.AddItem ("党员")
Combo1.AddItem ("无")
Combo2.Text = ""
End Sub
当输入查询类别、运算符和条件后可以查找到所需要的课程设置。
代码如下:
Dim sqlstr As String
Private Sub Command1_Click()
Dim a As String
Dim XSDA1 As String
Dim XSDA2 As String
a = Trim(Combo2)
Select Case a
Case "="
XSDA1 = "" & Combo1.Text & " " & Combo2.Text & " '" & Trim(Text1) & "'"
Case "like"
XSDA1 = "Instr(1," & Combo1.Text & ",'" & Trim(Text1.Text) & "')<>0 "
End Select
a = Trim(Combo4)
Select Case a
Case "="
XSDA2 = "" & Combo3.Text & " " & Combo4.Text & " '" & Trim(Text2) & "'"
Case "like"
www.youerw.com
strTiaoJian = "select * from 学生档案 where " & XSDA1
Else
strTiaoJian = "select * from 学生档案 where " & XSDA1 & "and " & XSDA2
End If
ElseIf Option3.Value = True Then
If XSDA1 = "" Then
strTiaoJian = "select * from 学生档案 where " & XSDA2
ElseIf XSDA2 = "" Then
strTiaoJian = "select * from 学生档案 where " & XSDA1
Else
strTiaoJian = "select * from 学生档案 where " & XSDA1 & "or " & XSDA2
End If
Else
If XSDA1 = "" Then
strTiaoJian = "select * from 学生档案 where " & XSDA2
ElseIf XSDA2 = "" Then
strTiaoJian = "select * from 学生档案 where " & XSDA1
End If
End If
If (XSDA1 & XSDA2) = "" Then
MsgBox "请输入查询条件!", vbOKOnly, "警告"
Exit Sub
Else
Unload Me
Frm_UpdateDangA.Show 1
End If
strTiaoJian = "select * from 学生档案 where " & sqlstr
Unload Me
Frm_UpdateDangA.Show 1
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=信息.mdb;Persist Security Info=False"
Combo1.AddItem ("学号")
Combo1.AddItem ("姓名")
Combo1.AddItem ("年级")
Combo1.AddItem ("专业")
上一页 [1] [2] [3] [4] [5] [6] 下一页