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

📄 dialogcreate.frm

📁 微软msde
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form DialogCreate 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "create database"
   ClientHeight    =   2460
   ClientLeft      =   5775
   ClientTop       =   3675
   ClientWidth     =   7365
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   2460
   ScaleWidth      =   7365
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton OKButton 
      Caption         =   "确定"
      Height          =   375
      Left            =   1920
      TabIndex        =   4
      Top             =   1560
      Width           =   1215
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "取消"
      Height          =   375
      Left            =   4200
      TabIndex        =   6
      Top             =   1560
      Width           =   1215
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   3480
      Locked          =   -1  'True
      TabIndex        =   0
      Top             =   360
      Width           =   2775
   End
   Begin VB.CommandButton Command1 
      Caption         =   "..."
      Height          =   375
      Left            =   6480
      TabIndex        =   1
      Top             =   360
      Width           =   615
   End
   Begin VB.TextBox Text3 
      Height          =   270
      Left            =   1800
      TabIndex        =   2
      Text            =   "1"
      Top             =   960
      Width           =   1095
   End
   Begin VB.TextBox Text4 
      Alignment       =   1  'Right Justify
      Height          =   270
      Left            =   5040
      TabIndex        =   3
      Text            =   "1"
      Top             =   960
      Width           =   1215
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   240
      Top             =   1440
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      Filter          =   "sql数据库(*.mdf)|*.mdf|所有文件(*.*)|*.*"
   End
   Begin VB.Label Label6 
      Caption         =   "M"
      Height          =   255
      Left            =   3000
      TabIndex        =   10
      Top             =   960
      Width           =   375
   End
   Begin VB.Label Label2 
      Caption         =   "请指定创建数据库的路径和数据库名:"
      Height          =   495
      Left            =   240
      TabIndex        =   9
      Top             =   360
      Width           =   3375
   End
   Begin VB.Label Label3 
      Caption         =   "SIZE:"
      Height          =   255
      Left            =   840
      TabIndex        =   8
      Top             =   960
      Width           =   855
   End
   Begin VB.Label Label4 
      Caption         =   "FILEGROWTH:"
      Height          =   255
      Left            =   3600
      TabIndex        =   7
      Top             =   960
      Width           =   1215
   End
   Begin VB.Label Label5 
      Alignment       =   2  'Center
      Caption         =   "%"
      Height          =   255
      Left            =   6360
      TabIndex        =   5
      Top             =   960
      Width           =   375
   End
End
Attribute VB_Name = "DialogCreate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim spath As String
Dim sfile As String
Private Sub CancelButton_Click()
    Unload Me
    
End Sub

Private Sub Command1_Click()
Dim result As String
        With CommonDialog1
            .DialogTitle = "创建"
            .CancelError = False
            'ToDo: 设置 common dialog 控件的标志和属性
            .ShowSave
            If Len(.FileName) = 0 Then
                Exit Sub
            End If
            sfile = .FileName
        End With
        spath = Left$(sfile, Len(sfile) - 4)
        Me.Text2.Text = sfile
End Sub


Private Sub OKButton_Click()
Dim result As String
    If Me.Text2.Text = "" Then
        result = MsgBox("请完成创建数据库信息", 0, "错误信息")
        Else
        Dim command As String
        Dim start As Integer
        start = 1
        While InStr(start + 1, sfile, "\", vbTextCompare) <> 0
            start = InStr(start + 1, sfile, "\", vbTextCompare)
        Wend
        sfile = Right$(sfile, Len(sfile) - start)
        sfile = Left$(sfile, Len(sfile) - 4)
        command = "CREATE DATABASE [" + sfile + "]" + Chr(10) + Chr(13)
        command = command + "ON PRIMARY (NAME = N'" + sfile + "_data'" + ",FILENAME = N'" + spath + "_data.mdf',SIZE = " + Me.Text3.Text + ",FILEGROWTH = " + Me.Text4.Text + "%)" + Chr(10) + Chr(13)
        command = command + "LOG ON (NAME = N'" + sfile + "_log'" + ",FILENAME = N'" + spath + "_log.ldf" + "',SIZE = " + Me.Text3.Text + ",FILEGROWTH = " + Me.Text4.Text + "%)" + Chr(10) + Chr(13)
        On Error GoTo er
        If Srun(command) = 1 Then Unload Me
    End If
Exit Sub
er:
   MsgBox err.Description, 0, "错误信息"
   Me.MousePointer = 0 '改变鼠标样子
End Sub




⌨️ 快捷键说明

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