From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=AXB_XMAILER_MIMEOLE_OL_024C2, BAYES_00,MAILING_LIST_MULTI autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b424ec4b490c1d84 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!freenix!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: "Andrew" Newsgroups: comp.lang.ada Subject: excel files Date: Wed, 6 Oct 2004 13:56:58 -0600 Organization: Cuivre, Argent, Or Message-ID: References: <20041006132018.833134C40CC@lovelace.ada-france.org> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: melchior.cuivre.fr.eu.org 1097091415 15143 212.85.156.195 (6 Oct 2004 19:36:55 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Wed, 6 Oct 2004 19:36:55 +0000 (UTC) To: Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:4832 Date: 2004-10-06T13:56:58-06:00 > ------------------------------ > From: Chris Humphries > Subject: Re: excel files [snip] > Does anyone have any portable Ada code to offer for parsing excel files? > I am a newbie to COM and MFC (well knew it about 6 years ago), and > do not understand how to go about using ODBC or GNATCOM to do the > suggested solutions to this problem. Can someone post some code showing > how to do this, please :) [snip] > ------------------------------ Well, it's not in Ada but this might give you an idea of how to connect via ODBC. This is an Active Server Page. ============ code below =============== <% @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. */ while(!objRecordSet.EOF){ objFields = objRecordSet.Fields; for(i=0; i < objFields.Count; i++){ Response.write(objFields.Item(i).Name+ " = " +objFields.Item(i).Value+"
"); } Response.write("
"); objRecordSet.MoveNext(); } /* * Don't forget to close the objects */ if(objRecordSet.State != adStateClosed){ objRecordSet.close(); } %> ============ end code ================ Andrew Carroll Carroll-Tech 720-273-6814 andrew@carroll-tech.net