国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

ASP.NET: Dispaly data from an Excel Spreadsheet

2024-07-10 13:03:29
字體:
來源:轉載
供稿:網友
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()
    
    dim strconn as string = "provider=microsoft.jet.oledb.4.0;" & _
                       "data source=" & replace(server.mappath("."), "/", "//") & "//exceltest.xls;" & _
                "extended properties=""excel 8.0;"""

    '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>

菜鳥學堂:
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 凤城市| 尤溪县| 武穴市| 雷州市| 洪洞县| 富宁县| 新乐市| 桐柏县| 大宁县| 叙永县| 富蕴县| 梅河口市| 射洪县| 博客| 浑源县| 萝北县| 如东县| 永修县| 灯塔市| 沧州市| 工布江达县| 平罗县| 曲阜市| 浙江省| 巴中市| 房产| 遂平县| 当雄县| 凌海市| 通道| 汉中市| 湾仔区| 潼关县| 宜良县| 华宁县| 清徐县| 通城县| 武功县| 若尔盖县| 固阳县| 泸州市|