ASP excel导出/导入Access数据库(代码+实例下载)
Excel导出函数
<%
Sub ExportToExcel
Response.ContentType = "application/vnd.ms-Excel"
Response.AddHeader "Content-Disposition", "attachment;Filename=Results.xls"
Response.Write "<body>"
Response.Write "<table border=1>"
Call WriteTableData
Response.Write "</table>"
Response.Write "</body>"
Response.Write "</html>"
End Sub
%>
Excel导入数据库
<%
dim FileName
FileName="Excel.xls" '取得文件名,来自项目经理的指定,路径固定在某个虚拟路径中
Dim conn, rs
set conn=CreateObject("ADODB.connection")
conn.Open "Driver={Microsoft Excel Driver (*.xls)};" & _
"DriverId=790;" & _
"Dbq=" & Server.mappath(""&FileName&"") & ";" & _
"DefaultDir=G:\"
set rs=createobject("ADODB.recordset")
rs.Open "Select * from [Sheet1$]",conn, 2, 2
if rs.eof then
response.write "Excel表中无纪录"
else
set connDB = Server.CreateObject("ADODB.Connection")
DBPath = Server.MapPath("Excel.mdb")
'RESPONSE.WRITE DBpath
connDB.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
Set RsDB = Server.CreateObject("ADODB.Recordset")
SQLDB="Select * from Excel"
RsDB.open SQLDB,connDB,1,3
do while not rs.eof '利用循环读出数据
RsDB.addnew
RsDB("filename")=rs(0)
RsDB("id1")=rs(1)
RsDB("id2")=rs(2)
RsDB("id3")=rs(3)
RsDB("id4")=rs(4)
Rs.update
RsDB.movenext
rs.movenext
loop
'response.redirect FileName
end if
RsDB.movefirst
if RsDB.eof then
response.write "数据库中无记录"
else
do while not RsDB.EOF
response.write RsDB("filename")&" "
response.write RsDB("id1")&" "
response.write RsDB("id2")&" "
response.write RsDB("id3")&" "
response.write RsDB("id4")&" "
re
相关文档:
一、Application对象
Application对象是个应用程序级的对象,用来在所有用户间共享信息,并可以在Web应用程序运行期间持久地保持数据。
Application的属性:
Application对象没有内置的属性,但是我们可以自行创建其属性。
<% Application(”属性名”)=值 %>
大部分Application变量都 存放在Con ......
1、分别安装三个环境,并设置不同端口
PHP:80
JSP:8080
ASP:8081
2、设置/Apache2/conf/httpd.conf
去掉以下三行前的注释:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
加入以下几行: ......
可以使用 ASP.NET Login 控件创建登录页。此控件提取用户名和密码,并使用 ASP.NET 成员资格和 Forms 身份验证来验证用户的凭据并创建身份验证票证。
1、创建一个使用 ASP.NET 成员资格的 ASP.NET Web 应用程序。有关详细信息和示例,请参见配置 ASP.NET 应用程序以使用成员资格 ......
1.错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] 操作必须使用一个可更新的查询。
这个错误一般只有在使用ACCESS数据库时才会出现。因为ACCESS在打开时会生成一个临时文件.ldb,这时文件夹如果没有写入权限时,则会发生错误。
解决方法如下:
1 ......