ASP.NET如何读取Excel文件的多张工作表
测试环境:windows server 2003+visual studio 2008
''' <summary>
''' 获取Excel文件所有工作表的名称
''' </summary>
''' <param name="iSubPath">Excel文件路径,如:D:\test.xls</param>
''' <returns></returns>
''' <remarks></remarks>
Public Function GetSheetName(ByVal iSubPath As String) As String
Dim strRet = ""
Dim objExcelConn As New OleDb.OleDbConnection
Dim i As Integer
Dim sSName As String = ""
Dim dtTables As DataTable
Dim sSql = ""
Dim objAdapter As New OleDbDataAdapter
Dim objDataSet As New DataSet
'Selects File & Loops Through the Records
objExcelConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & iSubPath & ";Extended Properties=""Excel 8.0;HDR=No;IMEX=1"""
objExcelConn.Open()
dtTables = objExcelConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing)
If dtTables.Rows.Count > 0 Then
For i = 0 To dtTables.Rows.Count - 1
sSName = dtTables.Rows(i)("TABLE_NAME")
sSName = Replace(sSName, "'", "")
 
相关文档:
以前没有遇到,今天以前同事问这个问题,整出来做为收藏
直接贴代码:
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(SenFe_Replace("沉下心去做好每一件事_2010_2_1_asp.net_你一定行"));
& ......
=================================================================================
How to enable an ASP.NET WebService to listen to HTTP POST calls
=================================================================================
Imagine you developed an ASP.NET WebService, but the client that nee ......
很多人都向在服务器端调用客户端的函数来操作,也就是在asp中调用javascript脚本中已经定义好的脚本函数。经过研究,发现了一些勉强的方法。
1. 用Response.Write方法写入脚本
比如在你单击按钮后,先操作数据库,完了后显示已经完成,可以在最后想调用的地方写上
Response.Write("<script type='text/javascrip ......