ASP reads Excel2000's article! ! !

zhaozj2021-02-17  55

Since the work needs to be used to read Excel's payroll, some data is found on the Internet to write the following procedures to give you :) <% '=================== == ASP reads the Excel Note =================================) 看 x e 文件 文件 (BOOK) generated by Excel97 or Excel2000 A database, each of which is a database table 'II) ADO assumes that the first line in Excel is the field name. So you must include the first line of content' III) Excel The row title (ie, the field name) cannot contain numbers. Excel drivers will be wrong when you encounter this problem. For example, your line title is "F1" 'IIII) If a column in your Excel spreadsheet contains text and numbers, then the ODBC driver of Excel will not be able to properly, processing the data type of this line, you must Ensure the data type of the column 'e-mail: kaxue@hotmail.com QQ: 484110 HomePage: www.flyday.net' Subscription Time: Thursday, May 23, 2002 5:54 PM Win2000 Server IIS5 test by '== ============================================================================================================================================================================================================= ================

DIM CONN, DRIVER, DBPATH, RS 'Establishing Connection Object Set Conn = Server.createObject ("AdoDb.Connection") Driver = "Driver = {Microsoft Excel Driver (* .xls)};" dbpath = "dbq =" & Server . Mappath ("test.xls") 'Call the OPEN method Open Database Conn.open Driver & Dbpath

'DSN connection mode' conn.open "DSN = Test" 'Name Name must be the following, "[Table name $]" Writing SQL = "SELECT * FROM [Sheet1 $] where serial number = 0" SET RS = Conn.execute (SQL)

If r r.eof and rs.bof the response.write, did not find the data you need !! "ELSE

Do While Not Rs.eof

Response.write RS ("Name")

Rs.movenext loop endiffs.close set rs = Nothing conn.close set conn = Nothing 'response.write "success!"%>

转载请注明原文地址:https://www.9cbs.com/read-28974.html

New Post(0)