📄 xboutin.frm
字号:
VERSION 5.00
Begin VB.Form xboutin
BorderStyle = 4 'Fixed ToolWindow
ClientHeight = 2775
ClientLeft = 45
ClientTop = 270
ClientWidth = 7290
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2775
ScaleWidth = 7290
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command3
Cancel = -1 'True
Caption = "退 出(&Y)"
Default = -1 'True
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5520
TabIndex = 5
Top = 2280
Width = 1575
End
Begin VB.PictureBox Picture1
BackColor = &H00FFE09E&
Height = 2775
Left = 0
Picture = "xboutin.frx":0000
ScaleHeight = 2715
ScaleWidth = 2475
TabIndex = 2
TabStop = 0 'False
Top = 0
Width = 2535
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "导入与导出"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 375
Index = 1
Left = 285
TabIndex = 4
Top = 765
Width = 2175
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "导入与导出"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Index = 0
Left = 255
TabIndex = 3
Top = 735
Width = 2280
End
Begin VB.Image Image1
Height = 600
Left = 360
Picture = "xboutin.frx":3A064
Stretch = -1 'True
Top = 120
Width = 600
End
Begin VB.Shape Shape1
BorderColor = &H000000FF&
BorderWidth = 2
Height = 15
Left = 240
Top = 1080
Width = 2175
End
Begin VB.Shape Shape2
BorderColor = &H0000FF00&
BorderWidth = 2
Height = 15
Left = 240
Top = 1125
Width = 2055
End
End
Begin VB.CommandButton Command2
Caption = "学分评测规则导入(&I)"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1095
Left = 2640
Picture = "xboutin.frx":3A4AE
Style = 1 'Graphical
TabIndex = 1
Top = 360
Width = 2055
End
Begin VB.CommandButton Command1
Caption = "登记数据导出(&O)"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1095
Left = 4800
Picture = "xboutin.frx":3BAF8
Style = 1 'Graphical
TabIndex = 0
Top = 360
Width = 2295
End
End
Attribute VB_Name = "xboutin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim nf As String
Dim kk As New addyear
Dim cc As New Scripting.FileSystemObject
If cc.FileExists(App.Path & "\temp.mmm") Then
FileSystem.Kill App.Path & "\temp.mmm"
End If
' 选者导出的年
yy = Year(Now)
If Month(Now) < 8 Then yy = yy - 1
kk.Label1.Caption = "清输入您欲导出哪一学年的纪录"
kk.Caption = "导出数据"
kk.Text1.Text = yy
kk.Show 1
If kk.yesno = False Then Exit Sub
ya = kk.kk
'选择导出的目标文件
Dim ftemp As New data_out1
ftemp.Show 1
If ftemp.yesno = False Then Exit Sub
nf = ftemp.ff
'建立临时处理环境
FileSystem.MkDir "c:\pianopan"
FileSystem.FileCopy App.Path & "\rar.exe", "c:\pianopan\rar.exe"
'关掉猪连接
main.connect.Close
'从猪数据库复制一个副本
FileSystem.FileCopy App.Path & "\scdb.mmm", App.Path & "\temp.mmm"
'复制标准会穿数据库
FileSystem.FileCopy App.Path & "\ccc.mmm", "c:\pianopan\" & getname(nf) & ".mmm"
'从副本数据库删除不需要的数据
main.connect.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\temp.mmm" & ";Jet OLEDB:Database Password=pianopan412424;Persist Security Info=False;"
main.connect.Execute "Delete from [gz] where [xn]<>'" & yy & "'"
main.connect.Execute "Delete from [jc] where [xn]<>'" & yy & "'"
main.connect.Execute "Delete from [wf] where [ye]<>'" & yy & "'"
'向会穿数据库的复制
Dim temps As New ADODB.Connection
temps.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "c:\pianopan\" & getname(nf) & ".mmm" & ";Jet OLEDB:Database Password=pianopan412424;Persist Security Info=False;"
Dim rf As New ADODB.Recordset
Dim rt As New ADODB.Recordset
rf.Open "select * from [class] ", main.connect, 3, 2
rt.Open "select * from [class] ", temps, 3, 2
For i = 1 To rf.RecordCount
rt.AddNew
rt.Fields(0) = rf.Fields(0)
rt.Fields(1) = rf.Fields(1)
rt.Fields(2) = rf.Fields(2)
rt.Fields(3) = rf.Fields(3)
rt.Update
rf.MoveNext
Next
rf.Close
rt.Close
rf.Open "select * from [gz] ", main.connect, 3, 2
rt.Open "select * from [gz] ", temps, 3, 2
For i = 1 To rf.RecordCount
rt.AddNew
rt.Fields(0) = rf.Fields(0)
rt.Fields(1) = rf.Fields(1)
rt.Fields(2) = rf.Fields(2)
rt.Fields(3) = rf.Fields(3)
rt.Fields(4) = rf.Fields(4)
rt.Fields(5) = rf.Fields(5)
rt.Fields(6) = rf.Fields(6)
rt.Fields(7) = rf.Fields(7)
rt.Fields(8) = rf.Fields(8)
rt.Update
rf.MoveNext
Next
rf.Close
rt.Close
rf.Open "select * from [jc] ", main.connect, 3, 2
rt.Open "select * from [jc] ", temps, 3, 2
For i = 1 To rf.RecordCount
rt.AddNew
rt.Fields(0) = rf.Fields(0)
rt.Fields(1) = rf.Fields(1)
rt.Fields(2) = rf.Fields(2)
rt.Fields(3) = rf.Fields(3)
rt.Fields(4) = rf.Fields(4)
rt.Fields(5) = rf.Fields(5)
rt.Fields(6) = rf.Fields(6)
rt.Fields(7) = rf.Fields(7)
rt.Update
rf.MoveNext
Next
rf.Close
rt.Close
rf.Open "select * from [student] ", main.connect, 3, 2
rt.Open "select * from [student] ", temps, 3, 2
For i = 1 To rf.RecordCount
rt.AddNew
rt.Fields(0) = rf.Fields(0)
rt.Fields(1) = rf.Fields(1)
rt.Fields(2) = rf.Fields(2)
rt.Fields(3) = rf.Fields(3)
rt.Fields(4) = rf.Fields(4)
rt.Fields(5) = rf.Fields(5)
rt.Fields(6) = rf.Fields(6)
rt.Update
rf.MoveNext
Next
rf.Close
rt.Close
rf.Open "select * from [wf] ", main.connect, 3, 2
rt.Open "select * from [wf] ", temps, 3, 2
For i = 1 To rf.RecordCount
rt.AddNew
rt.Fields(0) = rf.Fields(0)
rt.Fields(1) = rf.Fields(1)
rt.Fields(2) = rf.Fields(2)
rt.Fields(3) = rf.Fields(3)
rt.Fields(4) = rf.Fields(4)
rt.Update
rf.MoveNext
Next
rf.Close
rt.Close
rf.Open "select * from [xb] ", main.connect, 3, 2
rt.Open "select * from [xb] ", temps, 3, 2
For i = 1 To rf.RecordCount
rt.AddNew
rt.Fields(0) = rf.Fields(0)
rt.Fields(1) = rf.Fields(1)
rt.Update
rf.MoveNext
Next
rf.Close
rt.Close
rf.Open "select * from [yc] ", main.connect, 3, 2
rt.Open "select * from [yc] ", temps, 3, 2
For i = 1 To rf.RecordCount
rt.AddNew
rt.Fields(0) = rf.Fields(0)
rt.Fields(1) = rf.Fields(1)
rt.Fields(2) = rf.Fields(2)
rt.Fields(3) = rf.Fields(3)
rt.Update
rf.MoveNext
Next
rf.Close
rt.Close
rf.Open "select * from [zy] ", main.connect, 3, 2
rt.Open "select * from [zy] ", temps, 3, 2
For i = 1 To rf.RecordCount
rt.AddNew
rt.Fields(0) = rf.Fields(0)
rt.Fields(1) = rf.Fields(1)
rt.Fields(2) = rf.Fields(2)
rt.Update
rf.MoveNext
Next
rf.Close
rt.Close
temps.Close
main.connect.Close
main.connect.Open connectstring
'数据库复制完成
'进行数据库压缩
Dim textt As TextStream
Set textt = cc.CreateTextFile("c:\pianopan\pianopan.bat")
textt.WriteLine "rar a c:\pianopan\" & getname(nf) & ".fdd c:\pianopan\" & getname(nf) & ".mmm"
textt.Close
myrun "c:\pianopan\pianopan.bat"
FileSystem.FileCopy "c:\pianopan\" & getname(nf) & ".fdd", nf
FileSystem.Kill "c:\pianopan\" & getname(nf) & ".fdd"
FileSystem.Kill "c:\pianopan\" & getname(nf) & ".mmm"
FileSystem.Kill "c:\pianopan\rar.exe"
FileSystem.Kill "c:\pianopan\pianopan.bat"
FileSystem.RmDir "c:\pianopan"
Unload Me
MsgBox "成功"
End Sub
Private Sub Command2_Click()
Dim temp As New data_in
Dim ff As String
temp.Show 1
If temp.yesno = False Then Exit Sub
ff = temp.ff
'复制必要的文件
FileSystem.MkDir "c:\pianopan"
FileSystem.FileCopy ff, "c:\pianopan\" & getname(ff) & ".gz"
FileSystem.FileCopy App.Path & "\rar.exe", "c:\pianopan\rar.exe"
'建你皮处理文件
Dim scc As New Scripting.FileSystemObject
Dim textt As TextStream
Set textt = scc.CreateTextFile("c:\pianopan\pianopan.bat")
textt.WriteLine "rar e c:\pianopan\" & getname(ff) & ".gz c:\pianopan"
textt.Close
'运行皮处理文件
myrun "c:\pianopan\pianopan.bat"
'删除目标数据库
'FileSystem.Kill ff
'复制到目标路径
FileSystem.FileCopy "c:\pianopan\" & getname(ff) & ".mmm", getpath(ff) & getname(ff) & ".mmm"
'删除临时文件
FileSystem.Kill "c:\pianopan\" & getname(ff) & ".gz"
FileSystem.Kill "c:\pianopan\" & getname(ff) & ".mmm"
FileSystem.Kill "c:\pianopan\pianopan.bat"
FileSystem.Kill "c:\pianopan\rar.exe"
FileSystem.RmDir "c:\pianopan\"
Dim connect As New ADODB.Connection
connect.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & getpath(ff) & getname(ff) & ".mmm" & ";Jet OLEDB:Database Password=pianopan412424;Persist Security Info=False;"
Dim temp1 As New ADODB.Recordset
Dim temp2 As New ADODB.Recordset
temp1.Open "select * from [gz]", main.connect, 3, 2
temp2.Open "select * from [gztemp]", connect, 3, 2
Dim tgggg As New ADODB.Recordset
tgggg.Open "select * from [gz] where [xn]='" & temp2.Fields(8) & "'", main.connect, 3, 2
If tgggg.RecordCount <> 0 Then
If MsgBox("已有本学年的学分评定规定." & Chr(13) & Chr(10) & "是否用此文件覆盖现存学分评定规则?", vbYesNo Or vbInformation, "提示") = vbYes Then
Dim temp5 As New ADODB.Recordset
temp5.Open "select * from [jc] where [gzid] in (select [ID] from [gz] where [xn]='" & temp2.Fields(8) & "')", main.connect, 3, 2
If temp5.RecordCount <> 0 Then
MsgBox "本学分评测规定已经使用,无法覆盖", vbOKOnly Or vbInformation, "提示"
GoTo 1
Else
main.connect.Execute "delete * from [gz] where [xn]='" & temp2.Fields(8) & "'"
End If
Else
GoTo 1
End If
End If
For i = 1 To temp2.RecordCount
temp1.AddNew
temp1.Fields(0) = temp2.Fields(0)
temp1.Fields(1) = temp2.Fields(1)
temp1.Fields(2) = temp2.Fields(2)
temp1.Fields(3) = temp2.Fields(3)
temp1.Fields(4) = temp2.Fields(4)
temp1.Fields(5) = temp2.Fields(5)
temp1.Fields(6) = temp2.Fields(6)
temp1.Fields(7) = temp2.Fields(7)
temp1.Fields(8) = temp2.Fields(8)
temp1.Update
temp2.MoveNext
Next
temp1.Close
temp2.Close
MsgBox "导入成功", vbOKOnly Or vbInformation, "提示"
Unload Me
Exit Sub
1
connect.Close
FileSystem.Kill getpath(ff) & getname(ff) & ".mmm"
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Function getpath(filename As String) As String
getpath = Left(filename, InStrRev(filename, "\"))
End Function
Private Function getname(filename As String) As String
Dim temp As String
temp = Right(filename, Len(filename) - InStrRev(filename, "\"))
getname = Left(temp, InStrRev(temp, ".") - 1)
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -