' Feel Free to Add Your Own Content-Types Here
    Select Case strFileType
        Case ".asf"
            ContentType = "video/x-ms-asf"
        Case ".avi"
            ContentType = "video/avi"
        Case ".doc"
            ContentType = "application/msword"
        Case ".zip"
            ContentType = "application/zip"
        Case ".xls"
            ContentType = "application/vnd.ms-excel"
       ' Case ".ppt"
        '    ContentType = "application/vnd.ms-PowerPoint"
        Case ".gif"
            ContentType = "image/gif"
        Case ".jpg", "jpeg"
            ContentType = "image/jpeg"
        Case ".wav"
            ContentType = "audio/wav"
        Case ".mp3"
            ContentType = "audio/mpeg3"
        Case ".mpg", "mpeg"
            ContentType = "video/mpeg"
        Case ".rtf"
            ContentType = "application/rtf"
        Case ".htm", "html"
            ContentType = "text/html"
        Case ".asp"
            ContentType = "text/asp"
        Case Else
            'Handle All Other Files
            ContentType = "application/octet-stream"
    End Select
반응형
<%   
    Dim xmlPars
    Dim root
    Dim list
    Dim title
    Dim date2
    Dim url
    DIM i, subject, regdate

    Set xmlPars = Server.CreateObject("MicroSoft.XMLDOM")

    xmlPars.AppendChild(xmlPars.createProcessingInstruction("xml", "version=""1.0"" encoding=""UTF-8"""))
   
    Set root = xmlPars.CreateElement("scp")

    xmlPars.AppendChild(root)

    '### 각 노드에 값을 지정한다 ###
    For i = 0 To 3
        subject = "test"
        regdate = "2009-04-01"

        Set list = xmlPars.CreateElement("list")

        root.AppendChild(list)

        Set title = xmlPars.CreateElement("title")
        Set date2 = xmlPars.CreateElement("date")
        Set url = xmlPars.CreateElement("url")

        list.AppendChild(title)
        list.AppendChild(date2)
        list.AppendChild(url)

        list.childNodes(0).text =  subject
        list.childNodes(1).text =  regdate
        list.childNodes(2).text = "http://naver.com"
    Next
    Response.Write xmlPars.xml
%>

<결과 화면>
  <?xml version="1.0" ?>
- <scp>
- <list>
  <title>test</title>
  <date>2009-04-01</date>
  <url>http://naver.com</url>
  </list>
- <list>
  <title>test</title>
  <date>2009-04-01</date>
  <url>http://naver.com</url>
  </list>
- <list>
  <title>test</title>
  <date>2009-04-01</date>
  <url>http://naver.com</url>
  </list>
- <list>
  <title>test</title>
  <date>2009-04-01</date>
  <url>http://naver.com</url>
  </list>
  </scp>

반응형

<%

         Set DBCon = CreateObject("ADODB.Connection")

         dbCon.Open "file name=D:\wwwroot\util\Excel\strDB.udl"

        

         'pathXsl = Server.MapPath("\")&"\excel\excel_2.xls"

         pathXslFile = "D:\wwwroot\util\Excel\excel.xls"

        

         Set objFs   = CreateObject("Scripting.FileSystemObject")

         Set objFile = objFs.CreateTextFile(pathXslFile, true)

 

         SQL = "Select id, comp_nm, dept_nm " &_

                    "  From compinfo"

          

         Response.Write "SQL             :" & SQL & "<br>"

         Response.Write "생성될 파일경로 :" & pathXslFile

        

         Set Rs    = CreateObject("ADODB.RecordSet")

         Rs.open SQL, DBCon

                  

         ' 셀의 제목이 될 부분

         ' " " 부분을 탭으로 밀어주면 필드별로 입력

         xlsLine = "       "  

         xlsLine = xlsLine & "번호"   & "   "

         xlsLine = xlsLine & "업체명" & "   "

         xlsLine = xlsLine & "부서"   & "   "

 

        ' 실제 Excel 파일에 쓰기

         objFile.WriteLine(xlsLine)

        

         ' 셀의 값이 될 부분

         DO UNTIL Rs.EOF

                  xlsLine = "       "

                  xlsLine = xlsLine & rs(0) & "      "

                  xlsLine = xlsLine & rs(1) & "      "

                  xlsLine = xlsLine & rs(2) & "      "

                 

                  objFile.WriteLine(xlsLine)

 

                  Rs.MoveNext

         LOOP

%>

 

출처:http://cafe.naver.com/webzero0/279 

반응형
Function ReadBinaryFile(FileName)
Const adTypeBinary = 1

DIM BinaryStream

set BinaryStream = CreateObject("ADODB.Stream")

BinaryStream.Type = adTypeBinary

BinaryStream.Open
BinaryStream.LoadFromFile FileName

ReadBinaryFile = BinaryStream.Read
END Function
반응형

+ Recent posts