登录 注册
当前位置:主页 > 资源下载 > 9 > VB开发的饭店点菜系统

VB开发的饭店点菜系统

  • 更新:2024-12-18 10:39:20
  • 大小:9.52MB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:VB - 后端
  • 格式:RAR

资源介绍

漂亮的界面,可执行的代码 菜谱管理: Dim cnn As New ADODB.Connection Dim rsImage As New ADODB.Recordset Dim Chunk() As Byte Dim lngLengh As Long Dim intChunks As Integer Dim intFragment As Integer Const ChunkSize = 1000 Const lngDataFile = 1 Dim sql As String Private Sub back_Click() End Sub Private Sub Command1_Click(Index As Integer) Set DataGrid1.DataSource = Nothing sql = "delete * from huncai where cname='" & (Text1(2).Text) & "'" cnn.Execute sql MsgBox ("成功删除信息") Adodc1.Recordset.Update Adodc1.Refresh Set DataGrid1.DataSource = Adodc1 End Sub Private Sub Command2_Click() End End Sub Private Sub Command3_Click() If Text3.Text = "" Or Text4.Text = "" Then MsgBox ("请输入完整信息!") Else sql = "insert into huncai(sort,cname,price) values ('" & (Combo1.Text) & "' ,'" & (Text3.Text) & "' ,'" & Val(Text4.Text) & "')" If Trim(txtFilePath.Text) = "" Then MsgBox "未选择文件.!!", vbInformation + vbSystemModal, "保存出错" Exit Sub End If Open Trim(txtFilePath.Text) For Binary Access Read As lngDataFile lngLengh = LOF(lngDataFile) ' 文件大小 If lngLengh = 0 Then Close lngDataFile: Exit Sub intChunks = lngLengh \ ChunkSize intFragment = lngLengh Mod ChunkSize '新建记录 rsImage.AddNew ReDim Chunk(intFragment) Get lngDataFile, , Chunk() rsImage!picImage.AppendChunk Chunk() ReDim Chunk(ChunkSize) For i = 1 To intChunks Get lngDataFile, , Chunk() rsImage!picImage.AppendChunk Chunk() Next i rsImage.Update Close lngDataFile Call ShowPic cnn.Execute sql Adodc1.Refresh MsgBox ("添加成功!") End If End Sub Private Sub cmdBrowse_Click() On Error Resume Next With cmdlFilePath .Filter = "JPG Files|*.JPG|Bitmaps|*.BMP" .ShowOpen txtFilePath.Text = .FileName End With 'Picture1.Picture = LoadPicture(FileName) End Sub Public Sub ShowPic() On Error Resume Next Open "pictemp" For Binary Access Write As lngDataFile lngLengh = rsImage!picImage.ActualSize intChunks = lngLengh \ ChunkSize intFragment = lngLengh Mod ChunkSize ReDim Chunk(intFragment) Chunk() = rsImage!picImage.GetChunk(intFragment) Put lngDataFile, , Chunk() For i = 1 To intChunks ReDim Buffer(ChunkSize) Chunk() = rsImage!picImage.GetChunk(ChunkSize) '建立图片临时文件 Put lngDataFile, , Chunk() Next i Close lngDataFile FileName = "pictemp" Picture1.Picture = LoadPicture(FileName) End Sub Private Sub Command4_Click() Me.Hide Form7.Show End Sub Private Sub Command5_Click() Set DataGrid1.DataSource = Nothing Adodc1.Refresh Set DataGrid1.DataSource = Adodc1 Set Text1(0).DataSource = Adodc1 Set Text1(2).DataSource = Adodc1 Set Text1(3).DataSource = Adodc1 End Sub Private Sub Form_Load() Text1(0).Text = "" Text1(2).Text = "" Text1(3).Text = "" rsImage.LockType = adLockOptimistic rsImage.CursorType = adOpenKeyset cnn.Provider = "Microsoft.Jet.OLEDB.4.0" sql = "F:\课程设计\数据库\菜谱.mdb" cnn.Open sql sql = "Select * From huncai" rsImage.Open sql, cnn If (rsImage.BOF = True) And (rsImage.EOF = True) Then Exit Sub End Sub