⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vcdadd.frm

📁 原创VB+SQL影音租赁系统 醮简单 具体看里边的文本文档
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Width           =   285
   End
   Begin VB.Label Label11 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFC0FF&
      Caption         =   "影片类型"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   285
      Left            =   600
      TabIndex        =   29
      Top             =   3120
      Width           =   1140
   End
   Begin VB.Label Label10 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFC0FF&
      Caption         =   "剧照路径"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   285
      Left            =   4800
      TabIndex        =   28
      Top             =   3120
      Width           =   1140
   End
   Begin VB.Label Label9 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFC0FF&
      Caption         =   "影片添加"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   21.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000080FF&
      Height          =   435
      Left            =   4680
      TabIndex        =   27
      Top             =   480
      Width           =   1875
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFC0FF&
      Caption         =   "情节概述"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   285
      Left            =   600
      TabIndex        =   26
      Top             =   4800
      Width           =   1140
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFC0FF&
      Caption         =   "库存"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   285
      Left            =   7680
      TabIndex        =   25
      Top             =   2520
      Width           =   570
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFC0FF&
      Caption         =   "导演"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   285
      Left            =   960
      TabIndex        =   24
      Top             =   2520
      Width           =   570
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFC0FF&
      Caption         =   "主演"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   285
      Left            =   960
      TabIndex        =   23
      Top             =   1920
      Width           =   570
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFC0FF&
      Caption         =   "出版日期"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   285
      Left            =   600
      TabIndex        =   22
      Top             =   4200
      Width           =   1140
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFC0FF&
      Caption         =   "长度"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   285
      Left            =   5040
      TabIndex        =   21
      Top             =   2520
      Width           =   570
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFC0FF&
      Caption         =   "语言"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   285
      Left            =   7680
      TabIndex        =   20
      Top             =   1920
      Width           =   570
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFC0FF&
      Caption         =   "名称"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   285
      Left            =   960
      TabIndex        =   18
      Top             =   1320
      Width           =   570
   End
End
Attribute VB_Name = "VCDAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim com As Command
Dim rst As Recordset
Dim intstatus As Integer
Public tbname, picturepath As String


Private Sub CanncelBt_Click()
'autoid
VCDView.Show
VCDView.Refresh
VCDAdd.Visible = False
End Sub

Private Sub ClearBT_Click()
For Each Control In VCDAdd
    If TypeOf Control Is TextBox Then
       Control.Text = ""
    End If
Next
End Sub

Private Sub Dir1_Change()
On Error GoTo dirhandler
File1.Path = Dir1.Path
Exit Sub
dirhandler:
     Dir1.Path = Files.Path
End Sub

Private Sub Drive1_Change()
On Error GoTo drivehandler
    Dir1.Path = Drive1.Drive
Exit Sub
drivehandler:
    Drive1.Drive = Dir1.Path
End Sub

Private Sub File1_Click()
SelectedFile = File1.Path & "\" & File1.FileName
On Error GoTo picerr
Image1.Picture = LoadPicture(SelectedFile)
picturepath = SelectedFile
MsgBox picturepath
Exit Sub
picerr:
MsgBox "此文件不是图片文件!无法显示!请重新选择!"
End Sub

Private Sub Form_Load()
Set com = New Command
Set rst = New Recordset

'MsgBox tbname
autoid

For d = 1 To 31
Cday.AddItem (d)
Next d
Cday.ListIndex = 0
For m = 1 To 12
Cmonth.AddItem (m)
Next m
Cmonth.ListIndex = 0

For y = 2003 To 1930 Step -1
Cyear.AddItem (y)
Next y
Cyear.Text = 2003
End Sub

Private Sub Form_Unload(Cancel As Integer)
VCDAdd.Visible = False
VCDView.Show
'VCDView.Refresh

End Sub



Private Sub OKBT_Click()
intstatus = 1
tbname = ComboType.Text
'MsgBox tbname

Select Case ComboType.Text
       Case "爱情"
          tbname = "love"
          'tbn = "lov"
       Case "喜剧"
          tbname = "comedy"
          'tbn = "com"
       Case "卡通"
          tbname = "cartoon"
          'tbn = "car"
       Case "科幻"
          tbname = "science"
          'tbn = "sci"
       Case "冒险"
          tbname = "venture"
          'tbn = "ven"
       Case "动作"
          tbname = "action"
          'tbn = "act"
       Case "文艺"
          tbname = "art"
          'tbn = "art"
       Case "战争"
          tbname = "war"
          'tbn = "war"
       Case "广告"
          tbname = "advertisement"
          'tbn = "adv"
       Case "恐怖"
          tbname = "terror"
          'tbn = "ter"
End Select
autoid
'MsgBox id
'MsgBox tbname

For Each Control In VCDAdd
    If TypeOf Control Is TextBox Then
       If Control.Text = "" Then
          MsgBox "请输入完整的影片信息!"
          intstatus = 0
          Exit For
       End If
    End If
Next
If Asc(Trim(Tprice.Text)) > 57 Or Asc(Trim(Tprice.Text)) < 48 Then
   MsgBox "价格应输入数字!请注意!"
   Tprice.SetFocus
   Exit Sub
ElseIf Asc(Trim(Tlength.Text)) > 57 Or Asc(Trim(Tlength.Text)) < 48 Then
   MsgBox "长度应输入数字!请注意!"
   Tlength.SetFocus
   Exit Sub
ElseIf Asc(Trim(Tstock.Text)) > 57 Or Asc(Trim(Tstock.Text)) < 48 Then
   MsgBox "库存应输入数字!请确认!"
   Tstock.SetFocus
   Exit Sub
End If
If intstatus = 1 Then
    Dim nid, name, language, lenth, publishdate, price, parts, director, picpath, stock, story, level As String
    nid = Lid.Caption
    name = Tname.Text
    language = Tlanguage.Text
    lenth = Tlength.Text
    publishdate = Cyear & "-" & Cmonth & "-" & Cday
    price = Tprice.Text
    parts = Tparts.Text
    director = Tdirector.Text
    story = Tstory.Text
    'picpath = picturepath
    stock = Tstock.Text
    level = ComboLevel.Text
    
    MsgBox tbname
    MsgBox nid
    MsgBox publishdate
    rst.Open "insert " & tbname & " values ('" & nid & " ','" & name & "','" & language & " '," & _
    lenth & " ," & publishdate & " ," & price & " ,'" & parts & " ','" & director & " ', '" & _
    story & " ','" & picturepath & " ','" & level & " '," & stock & " )", con, adOpenDynamic, adLockOptimistic
    
    MsgBox "记录添加成功! :)"
    Dim a As Integer
        a = MsgBox("继续添加影片信息吗?", vbYesNo, "提示!:)")
    If a = 6 Then
        VCDAdd.Visible = True
    Else
        'rst.Close
        VCDAdd.Visible = False
        Exit Sub
    End If
    'rst.Close
    'autoid
End If
For Each Control In VCDAdd
    If TypeOf Control Is TextBox Then
       Control.Text = ""
    End If
Next

End Sub
Public Sub autoid()
Dim id As String
MsgBox tbname
'On Error GoTo err
rst.Open "select cId from " & tbname & " ", con, adOpenDynamic, adLockOptimistic

If rst.EOF = True Then
    id = "001"
Else
    id = getid(Trim(rst!cid))
    rst.MoveNext
    Do While rst.EOF = False
        If id = Trim(rst!cid) Then
            id = getid(Trim(rst!cid))
            rst.MoveNext
        Else
            Exit Do
        End If
    Loop
End If
rst.Close
Lid.Caption = id
Exit Sub
err:
MsgBox "请确认数据库是否连接!"
Unload Me
End Sub
Public Function getid(temp As String)
temp = temp + 1
If temp < 10 Then
    getid = "00" & temp
    Exit Function
End If
If temp < 100 Then
    getid = "0" & temp
    Exit Function
Else
    getid = temp
End If
End Function

Public Function gettbname(name As String)
tbname = name
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -