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

📄 客户信息管理.frm

📁 基于VB+SQL Server的零食销售管理系统设计
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      End
      Begin VB.TextBox Text2 
         Height          =   495
         Left            =   2040
         TabIndex        =   8
         Top             =   1200
         Width           =   2295
      End
      Begin VB.TextBox Text1 
         Height          =   495
         Left            =   2040
         TabIndex        =   7
         Top             =   480
         Width           =   2295
      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        =   6
         Top             =   4680
         Width           =   1335
      End
      Begin VB.Label Label5 
         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        =   5
         Top             =   3840
         Width           =   1335
      End
      Begin VB.Label Label4 
         Caption         =   "城市名称"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   120
         TabIndex        =   4
         Top             =   3000
         Width           =   1695
      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          =   495
         Left            =   120
         TabIndex        =   3
         Top             =   2160
         Width           =   1575
      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          =   495
         Left            =   120
         TabIndex        =   2
         Top             =   1320
         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        =   1
         Top             =   600
         Width           =   1575
      End
   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            =   6480
      TabIndex        =   21
      Top             =   2160
      Width           =   1815
   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
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()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
myres.Delete
MsgBox "删除成功!"
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
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 + -