comp.lang.ada
 help / color / mirror / Atom feed
From: "Andrew" <andrew@carroll-tech.net>
To: <comp.lang.ada@ada-france.org>
Subject: excel files
Date: Wed, 6 Oct 2004 15:58:26 -0600
Date: 2004-10-06T15:58:26-06:00	[thread overview]
Message-ID: <mailman.226.1097098703.390.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: 20041006203015.B3B864C40D1@lovelace.ada-france.org

Ooops,

I have a correction to the code I posted.

============ code below ===============
<!-- METADATA TYPE="typelib" FILE="C:\Program Files\Common
Files\system\ado\msado15.dll" -->
<html>
<head>
</head>
<body>

<% @Language = "JavaScript" %>
<%

/*
 * The provider is the path to the excel file.  The path provided here
is a relative path.
 * It is later combined with a call to Server.MapPath to generate the
absolute path.
 */
var provider = "\data\\NameOfExcelFile.xls";

/*
 * Our connection information.
 */
var cn = "Driver={Microsoft Excel Driver (*.xls)}; DBQ=" +
Server.MapPath(provider);

/*
 * Our recordset object to manipulate contents of the provider.
 * We are using ADODB, the connection is an ODBC connection.
 */
var objRecordSet = Server.CreateObject("ADODB.Recordset");

/*
 * Gives me the columns from the database.
 * Cheese is a named region in the spreadsheet.  To get a whole sheet
 * we would have to use $Sheet# instead of Cheese.
 */
SQL = "SELECT * FROM Cheese";
objRecordSet.Open(SQL, cn);

/*
 * Just output name=value pairs within the recordset.  one per line.
 */
objFields = objRecordSet.Fields;
while(!objRecordSet.EOF){

    for(i=0; i < objFields.Count; i++){
        Response.write(objFields.Item(i).Name+ " = "
+objFields.Item(i).Value+"<br>");
    }
    Response.write("<br>");
    objRecordSet.MoveNext();
}

/*
 * Don't forget to close the objects
 */
if(objRecordSet.State != adStateClosed){
    objRecordSet.close();
}
%>
</body>
============ end code ================





       reply	other threads:[~2004-10-06 21:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20041006203015.B3B864C40D1@lovelace.ada-france.org>
2004-10-06 21:58 ` Andrew [this message]
     [not found] <20041006132018.833134C40CC@lovelace.ada-france.org>
2004-10-06 19:56 ` excel files Andrew
     [not found] <20041005193515.6C38A4C409F@lovelace.ada-france.org>
2004-10-06  9:52 ` Andrew
2004-10-06 10:24   ` stephane richard
2004-10-06 11:58     ` Chris Humphries
2004-10-06 16:27       ` Warren W. Gay VE3WWG
2004-10-06 17:17         ` Chris Humphries
     [not found] <20041005034017.9E75B4C4137@lovelace.ada-france.org>
2004-10-05  6:49 ` Andrew
2004-10-05 21:37   ` David Botton
2004-10-04 19:16 Alexandre Devaure
2004-10-04 19:42 ` stephane richard
2004-10-04 20:02   ` Chris Humphries
2004-10-05  0:29   ` Jeffrey Carter
2004-10-05  1:20   ` Stephen Leake
2004-10-04 20:42 ` Martin Dowie
2004-10-04 22:20   ` Jeff C r e e.m
2004-10-05  7:45   ` Georg Bauhaus
2004-10-05 12:32     ` Chris Humphries
2004-10-05 14:16     ` David Botton
2004-10-04 21:40 ` tmoran
2004-10-05  6:30   ` Pascal Obry
2004-10-05 17:31     ` tmoran
2004-10-05 19:00       ` Alexandre Devaure
2004-10-05 19:02       ` Pascal Obry
2004-10-05  0:55 ` David Botton
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox