this code was written in response to a message posted on one of charles carroll's asp.net lists. you can sign up for one or all of the lists here.this page provides a simple example of how to query an excel spreadsheet from an asp.net page using vb.net.
code:
<%@ page language="vb" %> <%@ import namespace="system.data" %> <%@ import namespace="system.data.oledb" %> <html> <script language="vb" runat="server"> sub page_load(sender as object, e as eventargs) dim mydataset as new dataset()
'you must use the $ after the object you reference in the spreadsheet dim myoledbdataadapter as new oledbdataadapter("select * from [sheet1$]", strconn) myoledbdataadapter.fill(mydataset)
datagrid1.datasource = mydataset.tables(0).defaultview datagrid1.databind() end sub </script> </html>