Read the data in the Excel file into the DataGrid

xiaoxiao2021-03-06  64

Using the Excel file as a data source of DataGrid is very simple, once the data is loaded, you can save the data to SQL Server or XML. We only need to simply use Ole DB Provider to access the Excel file, and then return to DataSet. Below is the Excel Data Contact.xls to display:

Name

gender

address

NET_LOVERMALEAMXH @ 21cn.com @ 21cn.com Mencius E Chapter MaleAmxh@21cn.com

Just specify an Excel path and select a worksheet with [].

The full code is as follows:

<% @ Page language = "c #" debug = "true"%>

<% @ Import namespace = "system.data"%>

<% @ Import namespace = "system.data.oledb"%>