📄 database.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{3A6644DE-3402-11D9-9DE7-C33FAA87690A}#1.0#0"; "WinXPCEngine.ocx"
Begin VB.Form database
Caption = "数据库导入"
ClientHeight = 8745
ClientLeft = 60
ClientTop = 450
ClientWidth = 12015
Icon = "database.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 8745
ScaleWidth = 12015
StartUpPosition = 2 '屏幕中心
Begin WinXPC_Engine.WindowsXPC WindowsXPC1
Left = 2280
Top = 6120
_ExtentX = 6588
_ExtentY = 1085
ColorScheme = 2
Common_Dialog = 0 'False
End
Begin MSComctlLib.ProgressBar ProgressBar1
Align = 2 'Align Bottom
Height = 330
Left = 0
TabIndex = 6
Top = 8415
Width = 12015
_ExtentX = 21193
_ExtentY = 582
_Version = 393216
BorderStyle = 1
Appearance = 1
End
Begin MSAdodcLib.Adodc Adodc2
Height = 495
Left = 3120
Top = 7560
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc2"
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 MSAdodcLib.Adodc Adodc1
Height = 495
Left = 720
Top = 7440
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
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 MSComDlg.CommonDialog CommonDialog1
Left = 9360
Top = 600
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command_daoru
Caption = "导入ACCESS数据库中"
Height = 615
Left = 7560
TabIndex = 2
Top = 480
Width = 2775
End
Begin VB.CommandButton Command_open
Caption = "打开DBF数据库文件"
Height = 615
Left = 3240
TabIndex = 1
Top = 480
Width = 2775
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 6615
Left = 120
TabIndex = 0
Top = 1320
Width = 15015
_ExtentX = 26485
_ExtentY = 11668
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "条 "
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Left = 8520
TabIndex = 5
Top = 8160
Width = 315
End
Begin VB.Label Label2
Alignment = 2 'Center
AutoSize = -1 'True
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 210
Left = 8160
TabIndex = 4
Top = 8160
Width = 105
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "共有记录:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Left = 6960
TabIndex = 3
Top = 8160
Width = 930
End
End
Attribute VB_Name = "database"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public i As Integer
Public t As Integer
'Public p As Integer
Private Sub Command_daoru_Click() '将dbf文件导入到access文件中
Command_daoru.Enabled = False
Command_open.Enabled = True
Dim S As String
S = ConnectToDatabase
If S = False Then
MsgBox "由于各种原因导致数据库连接失败!", vbOKOnly + vbExclamation + vbDefaultButton1, "警告"
Else
ProgressBar1.Max = Adodc1.Recordset.RecordCount * 2
Adodc2.ConnectionString = conn.ConnectionString
Adodc2.CommandType = adCmdUnknown
Adodc2.RecordSource = "select * from information"
Adodc2.Refresh
For i = 1 To Adodc1.Recordset.RecordCount
If Adodc1.Recordset.Fields("xz").Value <> "" And Adodc1.Recordset.Fields("bhmc") <> "" And Adodc1.Recordset.Fields("sxh") <> "" And Adodc1.Recordset.Fields("zydm") <> "" Then
With Adodc2.Recordset
.AddNew
.Fields("xh") = Trim(Adodc1.Recordset.Fields("xh"))
.Fields("xm") = Trim(Adodc1.Recordset.Fields("xm"))
.Fields("yx") = Trim(Adodc1.Recordset.Fields("yx"))
.Fields("ZYMC") = Trim(Adodc1.Recordset.Fields("zymc"))
.Fields("BHMC") = Trim(Adodc1.Recordset.Fields("bhmc"))
.Fields("zyxh") = Trim(Adodc1.Recordset.Fields("zyxh"))
.Fields("xz") = Trim(Adodc1.Recordset.Fields("xz"))
.Fields("sxh") = Trim(Adodc1.Recordset.Fields("sxh"))
.Fields("zydm") = Trim(Adodc1.Recordset.Fields("zydm"))
.Fields("ksh") = Trim(Adodc1.Recordset.Fields("ksh"))
.Update
End With
End If
Adodc1.Recordset.MoveNext
ProgressBar1.Value = i * 2
Next
End If
Dim msg As String
msg = MsgBox("数据已导入完毕!是否关闭此窗体?", vbYesNo + vbInformation, "系统提示")
If msg = vbYes Then
Unload Me
End If
End Sub
Private Sub Command_open_Click() '打开一个dbf文件在datagrid控件中显示出来
'If Adodc1.Recordset.RecordCount <> 0 Then
' MsgBox "已经有一个打开的文件了。", vbInformation
'Else
CommonDialog1.DialogTitle = "Open Microsoft DBF File"
CommonDialog1.Filter = "Microsoft DBF File (*.dbf)|*.dbf" '设置保存对话框显示文件类型属性
CommonDialog1.ShowOpen
If CommonDialog1.CancelError = True Then
Exit Sub
End If
If Len(Trim(CommonDialog1.FileName)) = 0 Then
Exit Sub
End If
Adodc1.ConnectionString = "Provider=MSDASQL.1;Driver=Microsoft Visual Foxpro Driver;SourceDB=" & App.Path & "\" & CommonDialog1.FileName & ";SourceType=DBF"
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = CommonDialog1.FileName
Adodc1.Refresh
Adodc1.Recordset.MoveFirst
Set DataGrid1.DataSource = Adodc1
Label2.Caption = Adodc1.Recordset.RecordCount
Command_open.Enabled = False
Command_daoru.Enabled = True
End Sub
Private Sub Form_Load()
Command_daoru.Enabled = False
WindowsXPC1.InitSubClassing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -