www.pudn.com > SkyMediaSongTool.rar > Form7.frm
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form7
BorderStyle = 1 'Fixed Single
Caption = "歌曲编号重编"
ClientHeight = 6795
ClientLeft = 45
ClientTop = 435
ClientWidth = 10875
Icon = "Form7.frx":0000
LinkTopic = "Form7"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6795
ScaleWidth = 10875
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command4
Caption = "读取源表"
Height = 450
Left = 5955
TabIndex = 18
Top = 6210
Width = 1140
End
Begin VB.TextBox Text3
Height = 270
Left = 6270
TabIndex = 17
Top = 5895
Width = 4545
End
Begin VB.TextBox Text2
Height = 270
Left = 3165
TabIndex = 10
Text = "0"
Top = 5925
Width = 1560
End
Begin VB.TextBox Text1
Height = 270
Left = 1005
TabIndex = 8
Text = "0"
Top = 5925
Width = 1290
End
Begin VB.CommandButton Command3
Caption = "取消"
Height = 450
Left = 9570
TabIndex = 5
Top = 6210
Width = 1140
End
Begin VB.CommandButton Command2
Caption = "停止重编号"
Height = 450
Left = 8365
TabIndex = 4
Top = 6210
Width = 1140
End
Begin VB.CommandButton Command1
Caption = "开始重编号"
Height = 450
Left = 7160
TabIndex = 3
Top = 6210
Width = 1140
End
Begin MSComctlLib.ProgressBar PBar1
Height = 405
Left = 150
TabIndex = 2
Top = 5400
Width = 10605
_ExtentX = 18706
_ExtentY = 714
_Version = 393216
Appearance = 1
Scrolling = 1
End
Begin VB.Frame Frame2
Caption = "重编号后的表"
Height = 5325
Left = 5520
TabIndex = 1
Top = 30
Width = 5250
Begin MSComctlLib.ListView ListView2
Height = 5100
Left = 90
TabIndex = 15
Top = 195
Width = 5100
_ExtentX = 8996
_ExtentY = 8996
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 4
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "编码"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "歌名"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "歌手"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Text = "文件重命名"
Object.Width = 2540
EndProperty
End
End
Begin VB.Frame Frame1
Caption = "源表"
Height = 5325
Left = 150
TabIndex = 0
Top = 30
Width = 5250
Begin MSComctlLib.ListView ListView1
Height = 5100
Left = 75
TabIndex = 6
Top = 180
Width = 5100
_ExtentX = 8996
_ExtentY = 8996
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 4
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "编码"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "歌名"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "歌手"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Text = "文件校验"
Object.Width = 2540
EndProperty
End
End
Begin VB.Label Label7
Caption = "媒体文件路径:"
Height = 300
Left = 5085
TabIndex = 16
Top = 5925
Width = 1245
End
Begin VB.Label Label6
BorderStyle = 1 'Fixed Single
Caption = "0"
Height = 300
Left = 3615
TabIndex = 14
Top = 6315
Width = 1155
End
Begin VB.Label Label5
Caption = "已编号歌曲:"
Height = 240
Left = 2565
TabIndex = 13
Top = 6375
Width = 1050
End
Begin VB.Label Label4
BorderStyle = 1 'Fixed Single
Caption = "0"
Height = 300
Left = 1275
TabIndex = 12
Top = 6315
Width = 1155
End
Begin VB.Label Label3
Caption = "待编号歌曲:"
Height = 300
Left = 210
TabIndex = 11
Top = 6345
Width = 1080
End
Begin VB.Label Label2
Caption = "结止编号"
Height = 255
Left = 2355
TabIndex = 9
Top = 5925
Width = 795
End
Begin VB.Label Label1
Caption = "起始编号"
Height = 300
Left = 210
TabIndex = 7
Top = 5925
Width = 750
End
End
Attribute VB_Name = "Form7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rssource As New ADODB.Recordset
Dim rsd As New ADODB.Recordset
Dim sqlsource As String
Dim sqld As String
Dim isend As Boolean
Private Sub Command1_Click()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = True
Command4.Enabled = False
isend = False
On Error GoTo errhandle
sqlsource = "select * from " & Form1.Combo4.Text
sqld = "select * from newnumber_" & Form1.Combo4.Text
rssource.Open sqlsource, conn, 1, 1
rsd.Open sqld, conn, 1, 3
Label4.Caption = rssource.RecordCount
Text2.Text = CLng(Text1.Text) + rssource.RecordCount
PBar1.Max = rssource.RecordCount
PBar1.Value = 0
Do Until rssource.EOF
DoEvents
If isend = True Then Exit Do
If fso.FileExists(Trim(Text3.Text) & Trim(rssource("id")) & ".mpg") Or fso.FileExists(Trim(Text3.Text) & Trim(rssource("id")) & ".mp2") Or fso.FileExists(Trim(Text3.Text) & Trim(rssource("id")) & ".vob") Or fso.FileExists(Trim(Text3.Text) & Trim(rssource("id")) & ".dat") Then
tmpnewid = CLng(Text1.Text) + CLng(Label6.Caption)
rsd.AddNew
rsd("id") = CStr(tmpnewid)
If Trim(rssource("singname")) <> "" Or Not IsNull(rssource("singname")) Then rsd("singname") = Trim(rssource("singname"))
If Trim(rssource("singer")) <> "" Or Not IsNull(rssource("singer")) Then rsd("singer") = Trim(rssource("singer"))
If Trim(rssource("LANGUAGE")) <> "" Or Not IsNull(rssource("LANGUAGE")) Then rsd("LANGUAGE") = Trim(rssource("LANGUAGE"))
If Trim(rssource("LENGTHES")) <> "" Or Not IsNull(rssource("LENGTHES")) Then rsd("LENGTHES") = Trim(rssource("LENGTHES"))
If Trim(rssource("TYPE")) <> "" Or Not IsNull(rssource("TYPE")) Then rsd("TYPE") = Trim(rssource("TYPE"))
If Trim(rssource("DISKNAME")) <> "" Or Not IsNull(rssource("DISKNAME")) Then rsd("DISKNAME") = Trim(rssource("DISKNAME"))
If Trim(rssource("FILE_LOCA")) <> "" Or Not IsNull(rssource("FILE_LOCA")) Then rsd("FILE_LOCA") = Trim(rssource("FILE_LOCA"))
If Trim(rssource("AREA")) <> "" Or Not IsNull(rssource("AREA")) Then rsd("AREA") = Trim(rssource("AREA"))
If Trim(rssource("MTVORVCD")) <> "" Or Not IsNull(rssource("MTVORVCD")) Then rsd("MTVORVCD") = Trim(rssource("MTVORVCD"))
If Trim(rssource("SEX")) <> "" Or Not IsNull(rssource("SEX")) Then rsd("SEX") = Trim(rssource("SEX"))
If Trim(rssource("TEMP")) <> "" Or Not IsNull(rssource("TEMP")) Then rsd("TEMP") = Trim(rssource("TEMP"))
If Trim(rssource("QINDEX")) <> "" Or Not IsNull(rssource("QINDEX")) Then rsd("QINDEX") = Trim(rssource("QINDEX"))
Set addl = ListView2.ListItems.Add(, , CStr(tmpnewid))
addl.SubItems(1) = rssource("singname")
If Trim(rssource("singer")) <> "" Or Not IsNull(rssource("singer")) Then addl.SubItems(2) = rssource("singer")
If fso.FileExists(Trim(Text3.Text) & Trim(rssource("id")) & ".mpg") Then
Name Trim(Text3.Text) & Trim(rssource("id")) & ".mpg" As Trim(Text3.Text) & CStr(tmpnewid) & ".mpg"
addl.SubItems(3) = "重命名OK"
End If
If fso.FileExists(Trim(Text3.Text) & Trim(rssource("id")) & ".mp2") Then
Name Trim(Text3.Text) & Trim(rssource("id")) & ".mp2" As Trim(Text3.Text) & CStr(tmpnewid) & ".mp2"
addl.SubItems(3) = "重命名OK"
End If
If fso.FileExists(Trim(Text3.Text) & Trim(rssource("id")) & ".dat") Then
Name Trim(Text3.Text) & Trim(rssource("id")) & ".dat" As Trim(Text3.Text) & CStr(tmpnewid) & ".dat"
addl.SubItems(3) = "重命名OK"
End If
If fso.FileExists(Trim(Text3.Text) & Trim(rssource("id")) & ".vob") Then
Name Trim(Text3.Text) & Trim(rssource("id")) & ".vob" As Trim(Text3.Text) & CStr(tmpnewid) & ".vob"
addl.SubItems(3) = "重命名OK"
End If
rsd.Update
Label6.Caption = CLng(Label6.Caption) + 1
Text2.Text = CStr(CLng(Text1.Text) + CLng(Label6.Caption))
End If
rssource.MoveNext
If PBar1.Value < PBar1.Max Then PBar1.Value = PBar1.Value + 1
Loop
rssource.Close
rsd.Close
PBar1.Value = 0
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Form1.Text4.Text = CStr(CLng(Text2.Text) + 1)
Exit Sub
errhandle:
MsgBox "重编号过种中出现异常,可能是数据连接出错或文件读写权限错误!", vbOKOnly + vbCritical, "提示"
rssource.Close
rsd.Close
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Form1.Text4.Text = CStr(CLng(Text2.Text) + 1)
Exit Sub
End Sub
Private Sub Command2_Click()
isend = True
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
sqlsource = "select * from " & Form1.Combo4.Text
rssource.Open sqlsource, conn, 1, 1
If rssource.EOF And rssource.BOF Then
MsgBox "源表为空!", vbOKOnly + vbCritical, "提示"
rssource.Close
Exit Sub
End If
Label4.Caption = rssource.RecordCount
Text2.Text = 0
PBar1.Max = rssource.RecordCount
PBar1.Value = 0
ListView1.ListItems.Clear
ListView1.Visible = False
Do Until rssource.EOF
DoEvents
Set addlist = ListView1.ListItems.Add(, , rssource("id"))
addlist.SubItems(1) = rssource("singname")
If Not IsNull(rssource("singer")) Or Trim(rssource("singer")) <> "" Then addlist.SubItems(2) = rssource("singer")
If fso.FileExists(Trim(Text3.Text) & Trim(rssource("id")) & ".mpg") Or fso.FileExists(Trim(Text3.Text) & Trim(rssource("id")) & ".mp2") Or fso.FileExists(Trim(Text3.Text) & Trim(rssource("id")) & ".vob") Or fso.FileExists(Trim(Text3.Text) & Trim(rssource("id")) & ".dat") Then
addlist.SubItems(3) = "文件存在"
Else
addlist.SubItems(3) = "错误"
'addlist.ForeColor = RGB(ff, 0, 0)
End If
rssource.MoveNext
If PBar1.Value < PBar1.Max Then PBar1.Value = PBar1.Value + 1
Loop
ListView1.Visible = True
rssource.Close
PBar1.Value = 0
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
End Sub
Private Sub Form_Load()
isend = False
End Sub