欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          asp遍歷某路徑下文件夾并實現(xiàn)MP3數(shù)據(jù)保存到數(shù)據(jù)庫

          本文的示例是在asp中遍歷某路徑下文件夾,并把所有MP3數(shù)據(jù)讀到數(shù)據(jù)庫中,具體實現(xiàn)如下:

          <!–#include file=”Sql_Conn.asp”–><!–#include file=”Inc/Inc.asp”–><!–#include file=”Inc/Config.asp”–>
          <%
          function GetExtendName(FileName) 
          dim ExtName 
          ExtName = LCase(FileName) 
          ExtName = right(ExtName,3) 
          ExtName = right(ExtName,3-Instr(ExtName,”.”)) 
          GetExtendName = ExtName 
          end function

          ‘便歷某路徑下文件夾,把所有MP3數(shù)據(jù)讀到數(shù)據(jù)庫 
              function bianli(path)
                  dim fso            ‘fso對象
                  dim objFolder      ‘文件夾對象
                  dim objSubFolders ‘子文件夾集合
                  dim objSubFolder   ‘子文件夾對象
                  dim objFiles       ‘文件集合
                  dim objFile        ‘文件對象

                  set fso=server.CreateObject(“scripting.filesystemobject”)    
                  on error resume next
                  set objFolder=fso.GetFolder(path)’創(chuàng)建文件夾對象
                  set objSubFolders=objFolder.Subfolders’創(chuàng)建的子文件夾對象
                  for each objSubFolder in objSubFolders
                      ‘nowpath=path + “\” + objSubFolder.name
                      nowpath=path  + objSubFolder.name
                     ‘ Response.Write nowpath
                      set objFiles=objSubFolder.Files
                      for each objFile in objFiles
                        if GetExtendName(objFile.name)  = “mp3” then
                                        Response.Write “<br>”
                          ‘Response.Write objFile.name
                          
                          dim lc_lj 
                          lc_lj = nowpath + “/” +objFile.name
                          lc_lj=Mid(lc_lj,4)         ‘ 由lc_lj的第4個字符讀起,讀取后面的所有字符。
                          lc_lj=Replace(lc_lj,””,”/”)
                          ‘response.Write(lc_lj)
                          
                          dim lc_now
                          lc_now = now()
                          response.write lc_now
                          
                          dim sql_in
                          ‘sql_in = “insert into ylmv_dj(djCat_Id,specialid,Dj_name,Hits,dj_url,path,dj_pic,dj_user,tjuser,dj_word,dj_desc,IsBest,istop,grade,DownHits,BoxHits,uHits,dHits,DayHits,WeekHits,MonthHits,error,passed,points,music,dj_date,lasthittime) values(11,0,'”+ objFile.name  +”‘,0,'”+ lc_lj +”‘,5,’rm’,’紫龍舞曲管理’,’admin’,'”+ objFile.name +”‘,’☆☆★★★’,1,1,1,0,0,0,0,0,0,0,0,0,0,0,'”+lc_now +”‘,'”+lc_now+”‘)”

                          sql_in1 = “insert into ylmv_dj(djCat_Id,specialid,Dj_name,Hits,dj_url,path,dj_pic,dj_user,tjuser,dj_word,dj_desc,IsBest,istop,grade,DownHits,BoxHits,uHits,dHits,DayHits,WeekHits,MonthHits,error,passed,points,music,deleted) values(11,0,'”+ objFile.name  +”‘,0,'”+ lc_lj +”‘,5,’rm’,’紫龍舞曲管理’,’admin’,'”+ objFile.name +”‘,’☆☆★★★’,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0)”

                          ‘Response.Write objFile.name
                          ‘response.Write sql_in1
                          conn.execute(sql_in1)
                           Response.Write “<br>”
                          response.Write(“添加”+objFile.name+”!!!!!!”)
                        end if
                      

                      next
                      Response.Write “<p>”
                      bianli(nowpath)    ‘調(diào)用遞歸
                  next
                  set objFolder=nothing
                  set objSubFolders=nothing
                  set fso=nothing
              end function
          %>
          <%
              bianli(“F:Music”) ‘調(diào)用bianli()函數(shù),這里是遍歷F:盤
          %>

           

          分享到: 更多

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號