VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form add_lawyer 
   Caption         =   "添加律师信息"
   ClientHeight    =   3120
   ClientLeft      =   60
   ClientTop       =   285
   ClientWidth     =   4350
   LinkTopic       =   "Form1"
   ScaleHeight     =   3120
   ScaleWidth      =   4350
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox xingming 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   1860
      TabIndex        =   9
      Top             =   743
      Width           =   2000
   End
   Begin VB.ComboBox xingbie 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      ItemData        =   "addlawyer.frx":0000
      Left            =   1860
      List            =   "addlawyer.frx":000A
      TabIndex        =   8
      Text            =   "男"
      Top             =   1320
      Width           =   2000
   End
   Begin VB.ComboBox shiwusuo 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      ItemData        =   "addlawyer.frx":0016
      Left            =   1860
      List            =   "addlawyer.frx":0018
      TabIndex        =   7
      Top             =   1800
      Width           =   2000
   End
   Begin VB.CommandButton Command1 
      Caption         =   "取消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Left            =   3000
      TabIndex        =   6
      Top             =   2400
      Width           =   900
   End
   Begin VB.CommandButton Command4 
      Caption         =   "删除"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Left            =   1770
      TabIndex        =   5
      Top             =   2400
      Width           =   900
   End
   Begin VB.CommandButton Command2 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Left            =   540
      TabIndex        =   4
      Top             =   2400
      Width           =   900
   End
   Begin VB.TextBox bianhao 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   1860
      TabIndex        =   1
      Top             =   248
      Width           =   2000
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   -120
      Top             =   2640
      Visible         =   0   'False
      Width           =   2535
      _ExtentX        =   4471
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   1
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=CourtM"
      OLEDBString     =   "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=CourtM"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "select * from lawyerInformation"
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "所在事务所"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Left            =   405
      TabIndex        =   10
      Top             =   1800
      Width           =   1005
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "性      别"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Left            =   390
      TabIndex        =   3
      Top             =   1320
      Width           =   1035
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "姓      名"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Left            =   390
      TabIndex        =   2
      Top             =   795
      Width           =   1035
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "编      号"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Left            =   390
      TabIndex        =   0
      Top             =   300
      Width           =   1035
   End
End
Attribute VB_Name = "add_lawyer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim MaxNum As String

Private Sub Command1_Click()
Unload Me
End Sub


Private Sub Command2_Click()

Dim sql As String

        If flag = 1 Then
   Call addNewRecord
   MsgBox "添加成功！", vbOKOnly + vbExclamation, "添加结果！"

   
        Call init
    Else
    Call uprecord
       MsgBox "修改成功！", vbOKOnly + vbExclamation, "修改结果！"
Unload Me
 End If
End Sub

Private Sub Command4_Click()   '删除记录
        If MsgBox("真的要删除这条记录么？", vbOKCancel + vbExclamation, "提示！") = vbOK _
        Then
     ingid.Delete
        MsgBox "律师信息已经删除！", vbOKOnly + vbExclamation, "警告!"
        Unload Me
        End If
End Sub

Private Sub Form_Load()
Dim sql As String

    Dim num As Integer
    Dim temp As String
    Adodc1.RecordSource = "SELECT DISTINCT 所在事务所 FROM lawyerInformation "
    Adodc1.Refresh
    While Not Adodc1.Recordset.EOF
        shiwusuo.AddItem Adodc1.Recordset(0)
        Adodc1.Recordset.MoveNext
    Wend
    
    xingbie.ListIndex = 0
    
    If flag = 1 Then
        Call MaxNo
        Caption = "添加律师信息"
        Command4.Enabled = False
    Else
        Caption = "修改律师信息"
        Command2.Enabled = True
        Command4.Enabled = True
        Call display
    End If
End Sub

Private Sub init()   '初始化


    Dim num As Integer
    Dim temp As String
  Call MaxNo
            xingming.Text = ""
            xingbie.ListIndex = 0
           shiwusuo.Text = ""
End Sub
Private Sub addNewRecord()
     Dim sql As String

    sql = "select * from lawyerInformation"
    Adodc1.RecordSource = sql
    Adodc1.Refresh
    
    With Adodc1.Recordset
        .AddNew                                 '添加新记录
        .Fields(0) = Trim(bianhao)
        .Fields(1) = Trim(xingming)
        .Fields(2) = xingbie
        .Fields(3) = Trim(shiwusuo)
        .Update
    End With
    
End Sub
Public Sub display()
    bianhao.Enabled = False
 
    bianhao = ingid.Fields(0)
    xingming = ingid.Fields(1)
    xingbie = ingid.Fields(2)
    shiwusuo = ingid.Fields(3)
 End Sub
Public Sub uprecord()
            ingid.Fields(0) = Trim(bianhao)
            ingid.Fields(1) = Trim(xingming)
            ingid.Fields(2) = xingbie
            ingid.Fields(3) = shiwusuo
               ingid.Update

End Sub


'求最大编号
Sub MaxNo()
    Dim sql As String
    Dim num As Integer
    Dim temp As String
        sql = "select max(编号) from lawyerInformation"                  '自动编号
        Adodc1.RecordSource = sql
        Adodc1.Refresh
        
        MaxNum = Trim(Adodc1.Recordset(0))
        num = Right(MaxNum, 3) + 1
        temp = Right(Format(1000 + num), 3)
        bianhao = "L" & temp
End Sub


