Asp.net|excel This code is written in response to a, posted on one of Charles Carroll ' s asp.net lists. Can sign up for one or all of the lists. This page provides a simple example of the how to query an EXCEL spreadsheet the from a asp.net page using vb.net.
Code:
<%@ Page language= "VB"%>
<%@ Import namespace= "System.Data"%>
<%@ Import namespace= "System.Data.OleDb"%>
<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 for your 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>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.