Vítej hoste Hledat | Aktivní téma | Členové | Přihlásit se | Registrovat

Načtení dat z XLS dokumentu Možnosti
Jiří Tatoušek
Vloženo: Sunday, January 18, 2009 9:57:59 PM

Hodnocení: Administrátor

Registrován: 6/20/2002
Příspěvky: 213
Kód:
<%
Set cnnExcel = Server.CreateObject("ADODB.Connection")
    cnnExcel.Open "Dbq=" & Server.MapPath("data.xls") & "; Driver={Microsoft Excel Driver (*.xls)};"

    ' JSL_Data je nazev rozsahu v XLS dokumentu
    Set rstExcel = Server.CreateObject("ADODB.Recordset")
        rstExcel.Open "SELECT * FROM JSL_Data", cnnExcel, 3, 2

        iCols = rstExcel.Fields.Count

        Response.Write("<table>") & vbCrLf
        Response.Write("    <tr>") & vbCrLf
        For I = 0 To iCols - 1
            Response.Write("        <th>" & rstExcel.Fields.Item(I).Name & "</th>") & vbCrLf
        Next
        Response.Write("    </tr>") & vbCrLf

        rstExcel.MoveFirst

        Do While NOT rstExcel.EoF
            Response.Write("    <tr>") & vbCrLf
            For I = 0 To iCols - 1
                Response.Write("        <td>" & rstExcel.Fields.Item(I).Value & "</td>") & vbCrLf
            Next
            Response.Write("    </tr>") & vbCrLf
            rstExcel.MoveNext
        Loop

        Response.Write("</table>") & vbCrLf

        rstExcel.Close
    Set rstExcel = Nothing

    cnnExcel.Close
Set cnnExcel = Nothing
%>

Příloha:
java-tatousek-cz_script-0061.zip (4kb) staženo 4,510 krát.


Reklama
Vloženo: Sunday, January 18, 2009 9:57:59 PM
Uživatelé prohlížející toto téma
Guest

Přejít na fórum

Nemůžete zakládat nová téma do tohoto fóra.
Nemůžete odpovídat na téma v tomto fóru.
Nemůžete odstranit vaše příspěvky v tomto fóru.
Nemůžete editovat vaše příspěvky v tomto fóru.
Nemůžete vytvářet ankety v tomto fóru.
Nemůžete hlasovat v anketách v tomto fóru.

Hlavní fórum RSS : RSS

Copyright © 1997 - 2009, Jiří Tatoušek
Powered by Yet Another Forum.net & SGP Systems
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.