Use ASP. NET to access the Excel document + DataGrid to display data [NOTE: There are images in Excel]

Source: Internet
Author: User
Specific design ideas

(1). Obtain the name of the Excel file to be accessed

(2) read the content of an Excel file

(3). Display in datagrid format

Source 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 ()

Dim myoledbconnection as oledbconnection = new oledbconnection ("provider = Microsoft. Jet. oledb.4.0 ;"&_

"Data Source = c: \ full set of tables to keep track of tables .xls ;"&_

"Extended properties =" "Excel 8.0 ;""")

Dim myoledbcommand as oledbcommand = new oledbcommand ("select * from [meld $]", myoledbconnection)

Dim mydata as oledbdataadapter = new oledbdataadapter (myoledbcommand)

Mydata. Fill (mydataset)

Datagrid1.datasource = mydataset. Tables (0). defaultview

Datagrid1.databind ()

End sub

</SCRIPT>

<HTML>

<Head>
<Body>

<Asp: Label id = "L1" runat = "server"> </ASP: Label>

<Asp: DataGrid id = maid = "server"/>

</Body>

</Html>


However, this method can display the data in the Excel document, but it cannot display the image!

This document is as follows:


When displayed in a browser, the picture in the "Shoes" column will be blank! [No Data]

How can I modify the above section?ProgramIn the browser."Complete"What about the displayed Excel file?

Or, is there no better way to achieve it?

Dudu, I'm in a hurry. Please use it on the homepage for now!

Remove it immediately after discussion. Thank you!

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.