📄 forminputs.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{4406B9AC-521E-476B-AF25-3D2C36110576}#3.0#0"; "CommandSCE.ocx"
Begin VB.Form FormInputS
BorderStyle = 1 'Fixed Single
Caption = "学生数据管理"
ClientHeight = 6150
ClientLeft = 45
ClientTop = 435
ClientWidth = 5970
Icon = "FormInputS.frx":0000
LinkTopic = "Form3"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6150
ScaleWidth = 5970
StartUpPosition = 2 '屏幕中心
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 345
Left = 0
TabIndex = 5
Top = 5805
Width = 5970
_ExtentX = 10530
_ExtentY = 609
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
Object.Width = 10478
EndProperty
EndProperty
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 5220
Top = 3690
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSAdodcLib.Adodc AdoAddSTU
Height = 330
Left = 1830
Top = 750
Visible = 0 'False
Width = 2385
_ExtentX = 4207
_ExtentY = 582
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 = "AdoAddSTU"
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 CSCommandSCE.CommandSCE CommandSCE5
Height = 360
Left = 4500
TabIndex = 2
Top = 4860
Width = 1215
_ExtentX = 2143
_ExtentY = 635
IconAlign = 0
Icon = "FormInputS.frx":058A
Caption = "帮助"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ShowFocus = 0 'False
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 3780
Top = 4350
Visible = 0 'False
Width = 1920
_ExtentX = 3387
_ExtentY = 582
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 VB.PictureBox TDBGrid1
Height = 5685
Left = 60
ScaleHeight = 5625
ScaleWidth = 4215
TabIndex = 4
Top = 60
Width = 4275
End
Begin CSCommandSCE.CommandSCE CommandSCE4
Height = 360
Left = 4500
TabIndex = 0
Top = 120
Width = 1215
_ExtentX = 2143
_ExtentY = 635
ICOMaskColor = 16777215
IconAlign = 0
Icon = "FormInputS.frx":0B24
Caption = "选择文件"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ShowFocus = 0 'False
Appearance = 2
End
Begin CSCommandSCE.CommandSCE CommandSCE2
Height = 360
Left = 4500
TabIndex = 3
Top = 5370
Width = 1215
_ExtentX = 2143
_ExtentY = 635
IconAlign = 0
Icon = "FormInputS.frx":10BE
Caption = "关闭"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ShowFocus = 0 'False
End
Begin CSCommandSCE.CommandSCE CommandSCE1
Height = 360
Left = 4500
TabIndex = 1
Top = 630
Width = 1215
_ExtentX = 2143
_ExtentY = 635
IconAlign = 0
Icon = "FormInputS.frx":1658
Caption = "导入数据"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ShowFocus = 0 'False
Appearance = 2
End
End
Attribute VB_Name = "FormInputS"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub CommandSCE1_Click()
On Error Resume Next
If MsgBox("数据批量导入操作是不可逆的,确定进行操作?", vbQuestion + vbYesNo, "提示") = vbYes Then
AdoAddSTU.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\db\svdb.mdb;Persist Security Info=False"
AdoAddSTU.RecordSource = "SELECT TOP 1 年级, 班级, 编号, 姓名 FROM 成绩"
AdoAddSTU.Refresh
With Adodc1.Recordset
.Update
DoEvents
.MoveFirst
Dim I
For I = 1 To .RecordCount
AdoAddSTU.Recordset.AddNew
AdoAddSTU.Recordset.Fields("年级") = Trim(.Fields(0).Value)
AdoAddSTU.Recordset.Fields("班级") = Trim(.Fields(1).Value)
AdoAddSTU.Recordset.Fields("编号") = Trim(.Fields(2).Value)
AdoAddSTU.Recordset.Fields("姓名") = Trim(.Fields(3).Value)
.Update
.MoveNext
Next I
End With
If AdoAddSTU.Recordset.RecordCount > 0 Then
AdoAddSTU.Recordset.Update
Form1.FillTreeView
Call Form1.FillTDBGrid("nnnn", "nnn")
End If
MsgBox "数据导入完毕(切勿重复导入相同数据) ", , "提示"
End If
End Sub
Private Sub CommandSCE2_Click()
Unload Me
End Sub
Private Sub CommandSCE4_Click()
On Error Resume Next
CommonDialog1.Filter = "Excel学生信息文件|*.xls"
CommonDialog1.Action = 1
If CommonDialog1.FileName <> "" Then
Me.MousePointer = 13
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & CommonDialog1.FileName & ";Extended Properties='Excel 8.0;HDR=Yes'"
Adodc1.RecordSource = "SELECT * FROM [Sheet1$]"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
CommandSCE1.Enabled = True
Fill
Else
CommandSCE1.Enabled = False
End If
Me.MousePointer = 0
End If
End Sub
'====================设置表格项目
Private Sub Fill()
Me.MousePointer = 13
With TDBGrid1
.MarqueeStyle = dbgDottedCellBorder
.DataSource = Adodc1
.Columns(0).Width = 600
.Columns(1).Width = 500
.Columns(2).Width = 500
End With
Me.MousePointer = 0
StatusBar1.Panels(1).Text = "该文件记录数: " & Adodc1.Recordset.RecordCount
End Sub
Private Sub CommandSCE5_Click()
Dim CL
CL = Chr(10) & Chr(13)
MsgBox "待导入数据格式:" & CL & CL & _
"1 文件必须为 MICROSOFT OFFICE EXCEL 文件格式 [*.XLS] 。" & CL & _
"2 在工作表 ""SHEET1"" 中存储数据,暂不提供其他工作表导入!" & CL & _
"3 文件首行为 [年级] [班级] [编号] [姓名] ,顺序、内容必须准确!" & CL & CL & _
"该操作不可逆转,请慎重. "
End Sub
Private Sub Form_Load()
CommandSCE1.Enabled = False
AdoAddSTU.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\db\svdb.mdb;Persist Security Info=False"
AdoAddSTU.RecordSource = "SELECT TOP 1 年级, 班级, 编号, 姓名 FROM 成绩"
AdoAddSTU.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -