www.pudn.com > textmanager.rar > FRMDanWei.FRM, change:2005-04-12,size:14276b


VERSION 5.00 
Begin VB.Form FrmDanWei  
   BorderStyle     =   3  'Fixed Dialog 
   ClientHeight    =   3450 
   ClientLeft      =   2760 
   ClientTop       =   3465 
   ClientWidth     =   6000 
   ControlBox      =   0   'False 
   KeyPreview      =   -1  'True 
   LinkTopic       =   "Form1" 
   LockControls    =   -1  'True 
   MaxButton       =   0   'False 
   MinButton       =   0   'False 
   ScaleHeight     =   3450 
   ScaleWidth      =   6000 
   ShowInTaskbar   =   0   'False 
   StartUpPosition =   2  '屏幕中心 
   Begin VB.Frame Frame1  
      Caption         =   "单位信息维护" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   3210 
      Left            =   45 
      TabIndex        =   1 
      Top             =   225 
      Width           =   5940 
      Begin VB.CommandButton CmdSave  
         Caption         =   "保存" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         Height          =   435 
         Left            =   3660 
         TabIndex        =   15 
         Top             =   2625 
         Width           =   900 
      End 
      Begin VB.CommandButton CmdClose  
         Caption         =   "关闭" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         Height          =   435 
         Left            =   4785 
         TabIndex        =   14 
         Top             =   2610 
         Width           =   900 
      End 
      Begin VB.TextBox TXTurl  
         Appearance      =   0  'Flat 
         BackColor       =   &H00E8F4F8& 
         DataField       =   "电子邮箱地址" 
         DataSource      =   "datPrimaryRS" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         Height          =   315 
         Left            =   1320 
         MaxLength       =   100 
         TabIndex        =   12 
         Top             =   1590 
         Width           =   3840 
      End 
      Begin VB.TextBox TXTRen  
         Appearance      =   0  'Flat 
         BackColor       =   &H00E8F4F8& 
         DataField       =   "联系电话" 
         DataSource      =   "datPrimaryRS" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         Height          =   315 
         Left            =   4335 
         MaxLength       =   10 
         TabIndex        =   10 
         Top             =   705 
         Width           =   1350 
      End 
      Begin VB.TextBox TXTNumber  
         Appearance      =   0  'Flat 
         BackColor       =   &H00E8F4F8& 
         DataField       =   "公司代号" 
         DataSource      =   "datPrimaryRS" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         Height          =   330 
         Left            =   1320 
         MaxLength       =   30 
         TabIndex        =   5 
         Top             =   2010 
         Width           =   2685 
      End 
      Begin VB.TextBox TXTemail  
         Appearance      =   0  'Flat 
         BackColor       =   &H00E8F4F8& 
         DataField       =   "电子邮箱地址" 
         DataSource      =   "datPrimaryRS" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         Height          =   315 
         Left            =   1320 
         MaxLength       =   50 
         TabIndex        =   4 
         Top             =   1155 
         Width           =   2985 
      End 
      Begin VB.TextBox TXTPhone  
         Appearance      =   0  'Flat 
         BackColor       =   &H00E8F4F8& 
         DataField       =   "联系电话" 
         DataSource      =   "datPrimaryRS" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         Height          =   315 
         Left            =   1320 
         MaxLength       =   50 
         TabIndex        =   3 
         Top             =   720 
         Width           =   1785 
      End 
      Begin VB.TextBox TXTDWname  
         Appearance      =   0  'Flat 
         BackColor       =   &H00E8F4F8& 
         DataField       =   "公司名称" 
         DataSource      =   "datPrimaryRS" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         Height          =   300 
         Left            =   1320 
         MaxLength       =   200 
         TabIndex        =   2 
         Top             =   285 
         Width           =   4365 
      End 
      Begin VB.Label lblLabels  
         Caption         =   "单位主页:" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   10.5 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         ForeColor       =   &H00000000& 
         Height          =   255 
         Index           =   2 
         Left            =   300 
         TabIndex        =   13 
         Top             =   1605 
         Width           =   1050 
      End 
      Begin VB.Label lblLabels  
         Caption         =   "联系人:" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   10.5 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         ForeColor       =   &H00000000& 
         Height          =   255 
         Index           =   1 
         Left            =   3510 
         TabIndex        =   11 
         Top             =   750 
         Width           =   915 
      End 
      Begin VB.Label lblLabels  
         Caption         =   "单位编号:" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   10.5 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         ForeColor       =   &H00000000& 
         Height          =   255 
         Index           =   7 
         Left            =   315 
         TabIndex        =   9 
         Top             =   2040 
         Width           =   1050 
      End 
      Begin VB.Label lblLabels  
         Caption         =   "E-Mail地址:" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   10.5 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         ForeColor       =   &H00000000& 
         Height          =   255 
         Index           =   5 
         Left            =   90 
         TabIndex        =   8 
         Top             =   1170 
         Width           =   1155 
      End 
      Begin VB.Label lblLabels  
         Caption         =   "联系电话:" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   10.5 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         ForeColor       =   &H00000000& 
         Height          =   255 
         Index           =   4 
         Left            =   270 
         TabIndex        =   7 
         Top             =   720 
         Width           =   1095 
      End 
      Begin VB.Label lblLabels  
         Caption         =   "单位名称:" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   10.5 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         ForeColor       =   &H00000000& 
         Height          =   255 
         Index           =   0 
         Left            =   270 
         TabIndex        =   6 
         Top             =   315 
         Width           =   1095 
      End 
   End 
   Begin VB.CommandButton Command1  
      BackColor       =   &H00808080& 
      Caption         =   "X" 
      Height          =   195 
      Left            =   5835 
      Style           =   1  'Graphical 
      TabIndex        =   0 
      Top             =   -15 
      Width           =   180 
   End 
   Begin VB.Label Label1  
      BackStyle       =   0  'Transparent 
      Height          =   150 
      Left            =   0 
      TabIndex        =   16 
      Top             =   0 
      Width           =   5850 
   End 
   Begin VB.Line Line4  
      BorderColor     =   &H00E0E0E0& 
      BorderWidth     =   2 
      X1              =   0 
      X2              =   5940 
      Y1              =   135 
      Y2              =   135 
   End 
   Begin VB.Line Line3  
      BorderColor     =   &H00808080& 
      BorderWidth     =   2 
      X1              =   0 
      X2              =   5955 
      Y1              =   120 
      Y2              =   105 
   End 
   Begin VB.Line Line2  
      BorderColor     =   &H00E0E0E0& 
      BorderWidth     =   2 
      X1              =   -15 
      X2              =   5970 
      Y1              =   60 
      Y2              =   45 
   End 
   Begin VB.Line Line1  
      BorderColor     =   &H00808080& 
      BorderWidth     =   2 
      X1              =   -15 
      X2              =   6000 
      Y1              =   30 
      Y2              =   45 
   End 
End 
Attribute VB_Name = "FrmDanWei" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
 
Option Explicit 
Dim UpdateDW As Boolean '表明是否是更新单位信息 
Private Sub CmdClose_Click() 
 Unload Me 
End Sub 
 
Private Sub CmdSave_Click() 
 On Error GoTo myerr 
 If TXTDWname.Text = "" Then 
   MsgBox "请输入单位名称!" 
   TXTDWname.SetFocus 
   Exit Sub 
 End If 
 Dim sql As String 
 If UpdateDW = False Then 
   sql = "insert into danwei values('" + TXTDWname.Text + "','" + TXTPhone.Text + "','" + TXTRen.Text + "','" + TXTemail.Text + "','" + TXTurl.Text + "','" + TXTNumber.Text + "')" 
   Else 
   sql = "update danwei set name='" + TXTDWname.Text + "',phone='" + TXTPhone.Text + "',lman='" + TXTRen.Text + "',email='" + TXTemail.Text + "',url='" + TXTurl.Text + "',code='" + TXTNumber.Text + "'" 
 End If 
 DB.Execute sql 
 MsgBox "单位信息已经成功的保存!" 
 Exit Sub 
myerr: 
  MsgBox "信息里面不能包括非法字符" & "'" & "!" 
End Sub 
 
Private Sub Command1_Click() 
 Unload Me 
End Sub 
 
 
 
Private Sub Form_Activate() 
  TXTDWname.SetFocus 
 
End Sub 
 
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) 
 If KeyCode = 13 Then 
   CmdSave_Click 
 End If 
 If KeyCode = 27 Then 
   Unload Me 
 End If 
End Sub 
 
 
Private Sub Form_Load() 
 '查询单位信息 
 Dim sql As String 
 Dim adoRs As Recordset 
 Set adoRs = New Recordset 
 sql = "select * from danwei" 
 adoRs.Open sql, DB, adOpenStatic, adLockOptimistic 
 If adoRs.RecordCount > 0 Then 
    UpdateDW = True 
    TXTDWname.Text = adoRs.Fields(0).Value 
    TXTPhone.Text = adoRs.Fields(1).Value 
    TXTRen.Text = adoRs.Fields(2).Value 
    TXTemail.Text = adoRs.Fields(3).Value 
    TXTurl.Text = adoRs.Fields(4).Value 
    TXTNumber.Text = adoRs.Fields(5).Value 
 End If 
 adoRs.Close 
End Sub 
 
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 
       ReleaseCapture 
 Dim ret As Long 
  ret = SendMessage(Me.hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0) 
 
End Sub