在ASP中循环读取TXT文件内容问题?急再线等!

<%dimstatus,rline,MyFile,p,dialog_seq,goods_id,model,amount,mark,kwSetMyFileObject=Se... <%
dim status,rline,MyFile,p,dialog_seq,goods_id,model,amount,mark,kw

Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
'MyFile="D:\upload\dload.txt"
Set MyTextFile=MyFileObject.OpenTextFile("D:\load\upload.txt",1)
'打开dload.txt

IF not MyTextFile.atendofstream then

While Not MyTextFile.AtEndOfStream '到文件的末尾

rline =MyTextFile.ReadLine'读取一行

p=Instr(rline,",") '取得,号的位置
dialog_seq=Mid(rline,1,p-1) '取得,号前边的字符串(流水号)
rline=Mid(rline,p+1,Len(rline)-p) '设变量rline为,号后边的字符串
p=Instr(rline,",")
goods_id=Mid(rline,1,p-1) '取得,号前边的字符串(物资编码)
rline=Mid(rline,p+1,Len(rline)-p)
p=Instr(rline,",")
model=Mid(rline,1,p-1) '取得,号前边的字符串(型号)
rline=Mid(rline,p+1,Len(rline)-p)
p=Instr(rline,",")
kw=Mid(rline,1,p-1) '取得,号前边的字符串(库位)
rline=Mid(rline,p+1,Len(rline)-p)
p=Instr(rline,",")
amount=Mid(rline,1,p-1) '取得,号前边的字符串(数量)

response.write dialog_seq + " " + goods_id + " " + model + " " + kw + " " + amount &"<br>"

wend
MyTextFile.Close
else
response.write "数据为空"
response.end
end if
%>
TXT内容
ierp0000000000107057,5545108Y,H11Y-800-1,111,645
ierp0000000000107057,5545108Y,H11Y-800-1,111,1645
ierp0000000000107057,5545108Y,H11Y-800-1,111,645
ierp0000000000107057,5545108Y,H11Y-800-1,111,1645
ierp0000000000107057,5545108Y,H11Y-800-1,111,645
ierp0000000000107207,5525108Y,H11Y-800-1/2,111,641
ierp0000000000107207,5525108Y,H11Y-800-1/2,111,641
ierp0000000000107207,5525108Y,H11Y-800-1/2,111,641
ierp0000000000107207,5525108Y,H11Y-800-1/2,111,641
ierp0000000000107207,5525108Y,H11Y-800-1/2,111,641
请高手看看我哪个地方错了怎么读不出TXT里面的东西了?
1楼不能去掉
p=Instr(rline,",")
amount=Mid(rline,1,p-1) '取得,号前边的字符串(数量)
我需要把数量显示出来!现在的问题是如果我在每行的最后面加个逗号就能正常读取了!我不想加这个逗号,请问程序该如何写?
展开
 我来答
帐号已注销
2007-09-19 · TA获得超过1232个赞
知道大有可为答主
回答量:1245
采纳率:0%
帮助的人:1423万
展开全部
p=Instr(rline,",")
amount=Mid(rline,1,p-1) '

改为
p=Instrrev(rline,",")
amount=Mid(rline,1,len(rline))
测试通过
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式