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

📄 seuser1

📁 SQL Server 2000应用系统开发教案例 学习SQL Server 2000 的好东西!~
💻
字号:
VERSION 5.00
Begin VB.Form edrec1 
   Caption         =   "记录编辑"
   ClientHeight    =   2490
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4740
   LinkTopic       =   "Form1"
   ScaleHeight     =   2490
   ScaleWidth      =   4740
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Comm2 
      Caption         =   "取消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   510
      Left            =   2520
      TabIndex        =   3
      Top             =   1755
      Width           =   870
   End
   Begin VB.CommandButton Comm1 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   510
      Left            =   1440
      TabIndex        =   2
      Top             =   1755
      Width           =   870
   End
   Begin VB.Frame Frame1 
      Caption         =   "记录编辑"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   1275
      Left            =   315
      TabIndex        =   0
      Top             =   180
      Width           =   4020
      Begin VB.TextBox Text1 
         Height          =   330
         Left            =   1260
         TabIndex        =   1
         Text            =   "Text1"
         Top             =   495
         Width           =   2310
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "Label1"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   210
         Left            =   360
         TabIndex        =   4
         Top             =   540
         Width           =   735
      End
   End
End
Attribute VB_Name = "edrec1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cond As String

Private Sub Form_Load()
  Label1.Caption = cap
  If flag = 1 Then
    Text1.Text = ""
  Else
    Text1.Text = edrec.Adodc1.Recordset.Fields("fn")
  End If
End Sub

Private Sub comm1_Click()
  If flag = 1 Then '添加操作
     cond = "fn='" + Trim(Text1.Text) + "'"
     edrec.Adodc1.Recordset.MoveFirst   '每次从头开始查找
     edrec.Adodc1.Recordset.Find (cond)
     If Not edrec.Adodc1.Recordset.EOF() Then
        MsgBox "存在完全相同的记录", vbOKOnly, "信息提示"
        Text1.SetFocus
        Exit Sub
     End If
     edrec.Adodc1.Recordset.AddNew
     edrec.Adodc1.Recordset.Fields("fn") = Trim(Text1.Text)
     edrec.Adodc1.Recordset.Update
  Else          '修改操作
     n = edrec.Adodc1.Recordset.AbsolutePosition
     cond = "fn='" + Trim(Text1.Text) + "'"
     edrec.Adodc1.Recordset.MoveFirst  '每次从头开始查找
     edrec.Adodc1.Recordset.Find (cond)
     If Not edrec.Adodc1.Recordset.EOF() And edrec.Adodc1.Recordset.AbsolutePosition <> n Then
        MsgBox "存在完全相同的记录", vbOKOnly, "信息提示"
        edrec.Adodc1.Recordset.MoveFirst     '这两个语句恢复原记录位置
        edrec.Adodc1.Recordset.Move (n - 1)
        Text1.SetFocus
        Exit Sub
     End If
     edrec.Adodc1.Recordset.MoveFirst        '这两个语句恢复原记录位置
     edrec.Adodc1.Recordset.Move (n - 1)
     edrec.Adodc1.Recordset.Fields("fn") = Trim(Text1.Text)
     edrec.Adodc1.Recordset.Update
  End If
  Unload Me
End Sub

Private Sub Comm2_Click()
  Unload Me
End Sub

⌨️ 快捷键说明

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