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

📄 供应商信息查询.frm

📁 基于VB+SQL Server的零食销售管理系统设计
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Begin VB.TextBox Text2 
         Height          =   495
         Left            =   2160
         TabIndex        =   4
         Top             =   1080
         Width           =   2055
      End
      Begin VB.TextBox Text1 
         Height          =   495
         Left            =   2160
         TabIndex        =   3
         Top             =   360
         Width           =   2055
      End
      Begin VB.Label Label3 
         Caption         =   "联系电话"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   8
         Top             =   4560
         Width           =   1455
      End
      Begin VB.Label Label2 
         Caption         =   "邮政编码"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   9
         Top             =   3720
         Width           =   1455
      End
      Begin VB.Label Label1 
         Caption         =   "城市名称"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   10
         Top             =   2760
         Width           =   1455
      End
      Begin VB.Label Label8 
         Caption         =   "联系地址"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   12
         Top             =   1920
         Width           =   1335
      End
      Begin VB.Label Label7 
         Caption         =   "联系人姓名"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   11
         Top             =   1200
         Width           =   1455
      End
      Begin VB.Label Label6 
         Caption         =   "供应商公司名称"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   13
         Top             =   480
         Width           =   1695
      End
   End
   Begin VB.Label Label4 
      Caption         =   "请输入查找内容"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   6480
      TabIndex        =   20
      Top             =   2160
      Width           =   2055
   End
End
Attribute VB_Name = "供应商管理"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mycon As ADODB.Connection
Dim myres As ADODB.Recordset
Dim myres1 As ADODB.Recordset
Dim myres2 As ADODB.Recordset
Private Sub add_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
add.Enabled = False
del.Enabled = False
ok.Enabled = True
upd.Enabled = False
ok.Caption = "添加保存"
End Sub

Private Sub next_Click()
myres1.MoveNext
  If Not myres1.EOF Then
    Text1.Text = myres1.Fields(0)
    Text2.Text = myres1.Fields(1)
    Text3.Text = myres1.Fields(2)
    Text4.Text = myres1.Fields(3)
    Text5.Text = myres1.Fields(4)
    Text6.Text = myres1.Fields(5)
    
 Else
    
    myres1.MoveLast
    MsgBox "该记录为最后一条!", vbOKOnly + vbInformation, "提示"
  End If
  

End Sub

Private Sub ok_Click()
If ok.Caption = "添加保存" Then
  Set myres2 = New ADODB.Recordset
 Set myres2 = mycon.Execute("select * from 供应商信息 where 供应商公司名称= '" & Text1.Text & "'")
  If myres2.EOF And myres2.BOF Then
  mycon.Execute "insert 供应商信息 values ('" & Text1.Text & "' ,'" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text & "','" & Text6.Text & "')"
  MsgBox "添加成功!", vbOKOnly + vbInformation, "提示"
  Else
  MsgBox "此供应商已存在,无需添加!", vbOKOnly + vbInformation, "提示"
End If
End If
If ok.Caption = "更新保存" Then
mycon.Execute "update 供应商信息 set 联系人姓名='" & Text2.Text & "',联系地址='" & Text3.Text & "',城市名称='" & Text4.Text & "',邮政编码='" & Text5.Text & "',联系电话='" & Text6.Text & "'where 供应商公司名称='" & Text1.Text & "'"
MsgBox "更新成功!", vbOKOnly + vbInformation, "提示"
End If
add.Enabled = True
del.Enabled = True
ok.Enabled = False
upd.Enabled = True
ok.Caption = "保存"
End Sub

Private Sub del_Click()
mycon.Execute "delete from 供应商信息 where 供应商公司名称 = '" & Text1.Text & "'"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
MsgBox "删除成功!", vbOKOnly + vbInformation, "提示"
del.Enabled = False
ok.Enabled = True
End Sub

Private Sub Form_Load()
Set mycon = New ADODB.Connection
mycon.Open "dsn=my", "sa"
Set myres = New ADODB.Recordset
myres.Open "select  * from 供应商信息", mycon, adOpenDynamic, adLockOptimistic
End Sub

Private Sub pre_Click()
myres1.MovePrevious
  If Not myres1.BOF Then
    Text1.Text = myres1.Fields(0)
    Text2.Text = myres1.Fields(1)
    Text3.Text = myres1.Fields(2)
    Text4.Text = myres1.Fields(3)
    Text5.Text = myres1.Fields(4)
    Text6.Text = myres1.Fields(5)
  Else
    myres1.MoveFirst
    MsgBox "该记录为第一条!", vbOKOnly + vbInformation, "提示"
  End If

End Sub

Private Sub quit_Click()

Unload Me
      系统主页.Show
myres.Close
mycon.Close
Set mycon = Nothing
End Sub

Private Sub search_Click()
Dim style As String
If Option1.Value = True Then
style = "供应商公司名称"
End If
If Option2.Value = True Then
style = "联系人姓名"
End If
If Option3.Value = True Then
style = "联系地址"
End If
Set myres1 = New ADODB.Recordset
myres1.Open "select * from 供应商信息 where " & style & " = '" & Text7.Text & "'", mycon, adOpenDynamic, adLockOptimistic
If myres1.BOF And myres1.EOF Then
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
MsgBox "没有满足条件的记录!", vbOKOnly + vbInformation, "提示"
Else
Text1.Text = myres1.Fields(0)
Text2.Text = myres1.Fields(1)
Text3.Text = myres1.Fields(2)
Text4.Text = myres1.Fields(3)
Text5.Text = myres1.Fields(4)
Text6.Text = myres1.Fields(5)
End If
End Sub

Private Sub upd_Click()
add.Enabled = False
del.Enabled = False
upd.Enabled = False
ok.Caption = "更新保存"
ok.Enabled = True
End Sub

⌨️ 快捷键说明

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