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

首頁 > 學院 > 開發設計 > 正文

解決ASP導出查詢結果到Excel中的身份證號問題

2019-11-17 04:59:18
字體:
來源:轉載
供稿:網友
近日在用aspaccess數據庫的查詢結果導出為Excel文件時,出現一點問題,因為有一個字段是身份證號碼,在導出的excel文件中,所有身份證號后3位全部變成0了!真是郁悶啊!網上查了一下才知道是excel默認的數字格式是"常規",只能正常顯示輸入的11位數字,超過11位就用科學記數法顯示了。
為了解決這個問題,我只能把查詢的數據標識成文本型數據,下面是部份代碼:
<%
'導出到excel
set rs = server.createobject("adodb.recordset")
sqlstr="select * from tabname where"&searhsql '查詢語句
rs.open sqlstr,oconn,1,3
%>
<%set fs = server.createobject("scr'存放文件
filename="info.xls"
temp=filename
filename=request.servervariables("appl_physical_path")&"&#92;"+filename
'刪除存在的excel文件
'if fs.fileexists(filename) then
'fs.deletefile(filename)
'end if
'-創建excel文件
set myfile = fs.createtextfile(filename,true)
dim strline,responsestr
strline=""
for each x in rs.fields
strline= strline & x.name & chr(9)
next
'將表的列名先寫入excel
myfile.writeline strline
while not rs.eof
strline=""
for each x in rs.fields
'這里把數據標識成文本類型
strline= strline & "="""&x.value &""""& chr(9)
next
'將表的數據寫入excel
myfile.writeline strline
rs.movenext
wend
link="<a href=&#92;" & temp & " title=將數據保存至eecel表中><font color=red><b>導出excel文件</b></font></a>"
response.write link
set myfile = nothing
set fs=nothing
rs.close
%>
實例源代碼下載:
http://code.VeVb.com/down/12254.html
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 鄱阳县| 荃湾区| 新邵县| 华池县| 武平县| 马公市| 外汇| 正安县| 米易县| 林甸县| 岚皋县| 巩留县| 阿鲁科尔沁旗| 离岛区| 蚌埠市| 霍林郭勒市| 安图县| 梅河口市| 眉山市| 宝丰县| 永嘉县| 平阴县| 巫山县| 长岛县| 房产| 榆林市| 青田县| 玉林市| 浦县| 浪卡子县| 贵州省| 云安县| 金湖县| 昌宁县| 龙川县| 禄劝| 宝应县| 浦江县| 松潘县| 什邡市| 堆龙德庆县|