📄 frmexport.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmexport
BackColor = &H00FFFFFF&
Caption = "导出数据"
ClientHeight = 1290
ClientLeft = 60
ClientTop = 450
ClientWidth = 3555
LinkTopic = "Form1"
ScaleHeight = 1290
ScaleWidth = 3555
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox cobexport
Height = 300
Left = 1080
TabIndex = 2
Text = "请选择导出方式"
Top = 240
Width = 2415
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 480
TabIndex = 1
Top = 720
Width = 975
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2160
TabIndex = 0
Top = 720
Width = 975
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 3360
Top = 720
_ExtentX = 847
_ExtentY = 847
_Version = 393216
Filter = "*.xls|*.xls"
End
Begin VB.Label Label1
BackColor = &H00FFFFFF&
Caption = "请选择:"
Height = 255
Left = 120
TabIndex = 3
Top = 270
Width = 975
End
End
Attribute VB_Name = "frmexport"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
'学生
Dim sql As String
If export = "student" Then
If cobexport.Text = "报表" Then
ReportPrint.Show
'DataReport2.Show
Unload Me
ElseIf cobexport.Text = "Excel" Then
CommonDialog1.ShowSave
sql = "EXEC master..xp_cmdshell 'bcp MyDB.dbo.Student out " & CommonDialog1.FileName & " -c -q -S(Local) -Usa -P""'"
adoCon.Execute (sql)
If CommonDialog1.FileTitle <> "" Then
MsgBox "成功导出!", vbOKOnly + vbInformation, "成功提示"
Unload Me
End If
End If
'课程
ElseIf export = "lesson" Then
If cobexport.Text = "报表" Then
DataReport1.Show
Unload Me
ElseIf cobexport.Text = "Excel" Then
CommonDialog1.ShowSave
sql = "EXEC master..xp_cmdshell 'bcp MyDB.dbo.Lesson out " & CommonDialog1.FileName & " -c -q -S(Local) -Usa -P""'"
adoCon.Execute (sql)
If CommonDialog1.FileTitle <> "" Then
MsgBox "成功导出!", vbOKOnly + vbInformation, "成功提示"
Unload Me
End If
End If
'成绩
ElseIf export = "mark" Then
If cobexport.Text = "报表" Then
DataReport2.Show
Unload Me
ElseIf cobexport.Text = "Excel" Then
CommonDialog1.ShowSave
sql = "EXEC master..xp_cmdshell 'bcp MyDB.dbo.Score out " & CommonDialog1.FileName & " -c -q -S(Local) -Usa -P""'"
adoCon.Execute (sql)
If CommonDialog1.FileTitle <> "" Then
MsgBox "成功导出!", vbOKOnly + vbInformation, "成功提示"
Unload Me
End If
End If
'宿舍
ElseIf export = "sushe" Then
If cobexport.Text = "报表" Then
DataReport3.Show
Unload Me
ElseIf cobexport.Text = "Excel" Then
CommonDialog1.ShowSave
sql = "EXEC master..xp_cmdshell 'bcp MyDB.dbo.宿舍 out " & CommonDialog1.FileName & " -c -q -S(Local) -Usa -P""'"
adoCon.Execute (sql)
If CommonDialog1.FileTitle <> "" Then
MsgBox "成功导出!", vbOKOnly + vbInformation, "成功提示"
Unload Me
End If
End If
'交费
ElseIf export = "cost" Then
If cobexport.Text = "报表" Then
DataReport4.Show
Unload Me
ElseIf cobexport.Text = "Excel" Then
CommonDialog1.ShowSave
sql = "EXEC master..xp_cmdshell 'bcp MyDB.dbo.Cost out " & CommonDialog1.FileName & " -c -q -S(Local) -Usa -P""'"
adoCon.Execute (sql)
If CommonDialog1.FileTitle <> "" Then
MsgBox "成功导出!", vbOKOnly + vbInformation, "成功提示"
Unload Me
End If
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Height = 1800
Me.Width = 3675
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2 - 800
With cobexport
.AddItem "Excel"
.AddItem "报表"
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -