Public Sub SaveImage(ByVal ImageFile As String, _
                     Adodc1 As Adodc)
  
  If Adodc1.Recordset.BOF = True Or Adodc1.Recordset.EOF = True Then
    Exit Sub
  End If
  If ImageFile = "" Then
    Exit Sub
  End If
  '提供一个尚未使用的文件号
  SourceFile = FreeFile
  '打开文件
  Open ImageFile For Binary Access Read As SourceFile
  '得到文件长度
  FileLength = LOF(SourceFile)
  '判断文件是否存在
  If FileLength = 0 Then
    Close SourceFile
    MsgBox DiskFile & "无内容或不存在!"
  Else
    NumBlocks = FileLength \ BlockSize '得到数据块的个数
    LeftOver = FileLength Mod BlockSize '得到剩余字节数
    Adodc1.Recordset.Fields(2).Value = Null
    ReDim byteData(BlockSize) '重新定义数据块的大小
    For i = 1 To NumBlocks
      Get SourceFile, , byteData() '读到内存块中
      Adodc1.Recordset.Fields(2).AppendChunk byteData()  '写入FLD
    Next i
    ReDim byteData(LeftOver) '重新定义数据块的大小
    Get SourceFile, , byteData() '读到内存块中
    Adodc1.Recordset.Fields(2).AppendChunk byteData()  '写入FLD
    Close SourceFile '关闭源文件
    Adodc1.Recordset.update
  End If
End Sub
3.4.2用户约束性检查
Private Sub cmd_commit_Click()
If (txtsud_name.Text = "") Then
      MsgBox "请输入你的姓名"
      txtsud_name.SetFocus
ElseIf txtstu_id.Text = "" Then
 MsgBox "请输入你的学号"
 txtstu_id.SetFocus
 
ElseIf txtstu_profession.Text = "" Then
  MsgBox "请输入你的专业,以便审查"
  txtstu_profession.SetFocus
ElseIf txtstu_xueli.Text = "" Or txtstu_political.Text = "" Or txtstu_English.Text = "" Then
  MsgBox "学历,政治面貌,英语水平三项为必填"
ElseIf Lench(txtstu_id.Text) < 7 Or Lench(txtstu_id.Text) > 11 Then
   MsgBox "学号必须大于7位并且小于11位"
   txtstu_id.SetFocus
   Exit Sub
Else: insertEnd If
End Sub
3.4.3毕业生查询本人的基本信息
Private Sub Command2_Click()
If Len(Trim(txtstuid)) = 0 Then
    MsgBox "请输入学号"
    txtstuid.SetFocus
    txtstuid.SelStart = 0
    txtstuid.SelLength = Len(txtName)
    CurStu.Init
    Image1.Picture = LoadPicture("")    Exit Sub  End If
上一页 [1] [2] [3] [4] [5] [6] 下一页