Import form Excel (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


wizard_oz -> Import form Excel (2/22/2006 5:23:30)

Hi, I have an Excel sheet and I would like show the data on my web page, I coonected the Excel to the ODBC, I have the code which is working for Access
What Should I do to make it works for the excel?
Thanks, Elen
<%
	dim conn,rs,sql
	set conn=server.CreateObject("ADODB.recordset")
	conn.Open "dsn=tester"
	set rs=server.CreateObject("ADODB.recordset")
	sql="select * from Sheet1"
	rs.Open sql,conn
	
	while not rs.EOF
		Response.Write fname
		rs.MoveNext
	wend
	
		
	rs.Close
	set rs=nothing
	conn.Close
	set conn=nothing
%>




rdouglass -> RE: Import form Excel (2/22/2006 9:32:58)

With Excel files, I usually don't bother with a DSN but address it directly something like this:

dim conn,rs,sql
set conn=server.CreateObject("ADODB.recordset")
conn.Open "DRIVER=Microsoft Excel Driver (*.xls); DBQ=" & Server.MapPath("/myFolder/mySpreadSheet.xls")
set rs=conn.execute("select * from Sheet1")

.......

That help any?
....




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125