asp教程.net 读取excel数据
<%@ page language="vb" autoeventwireup="false" codefile="excel.aspx.vb" inherits="_excel" %>
<%
imports microsoft.office.interop
partial class _excel
inherits system.web.ui.pageprotected sub btnrexcel_click(byval sender as object, byval e as system.eventargs) handles btnrexcel.click
dim strpath as string = file1.postedfile.filename
if strpath = "" then
me.response.write("请选择要导入的excel数据文件!")
elsedim excelfilepath as string = strpath
dim myexcel as excel.application = new excel.applicationclass() '创建一个excel对象
dim omissing as object = system.reflection.missing.value
myexcel.application.workbooks.open(excelfilepath, omissing, omissing, omissing, omissing, omissing, omissing, omissing, omissing, omissing, omissing, omissing, omissing, omissing, omissing)
dim mybook as excel.workbook = myexcel.workbooks(1) '定义一个工作表组
dim mysheet as excel.worksheet = ctype(mybook.worksheets(cint(textbox3.text)), excel.worksheet) '定义一个工作表dim r as excel.range = ctype(mysheet.cells(cint(textbox1.text), cint(textbox2.text)), excel.range)
me.response.write("excel中第" & textbox1.text & "行 第" & textbox2.text & "列的值:" & (r.value).tostring)
excelgc(myexcel, mybook, mysheet, r)end if
end sub
'关闭excel进程
private shared sub excelgc(byref myexcel as excel.application, byref mybook as excel.workbook, byref mysheet as excel.worksheet, byref r as excel.range)
mybook.close(false, type.missing, type.missing)
myexcel.quit()
system.runtime.interops教程ervices.marshal.releasecomobject(r)
system.runtime.interopservices.marshal.releasecomobject(myexcel)
system.runtime.interopservices.marshal.releasecomobject(mysheet)
system.runtime.interopservices.marshal.releasecomobject(mybook)
mysheet = nothing
mybook = nothing
myexcel = nothing
r = nothing
gc.collect()
end sub
end class
%>
创造与魔法 安卓版v1.0.0750
创造与魔法是一款开放世界手游,在游戏中玩家可探索这个奇妙的世
创造与魔法修改版 最新版v1.0.0750
创造与魔法无限点券版是款探索冒险游戏,该款游戏的操作还是蛮自
战争与文明官方版本 安卓版v1.7.16
战争与文明是一款由上海邮通科技有限公司开发的战争策略游戏,这
迷你世界0元领皮肤无限迷你币版 最新安卓版v1.43.0
迷你世界0元购买皮肤版是这款开放沙盒冒险建造游戏的特殊破解版
创造与魔法无限经验版 安卓版v1.0.0750
创造与魔法无限经验版是款可以改造环境,整个游戏的自由度还是蛮