当前位置:首页 » 多媒体相关

师兄:文本。。。。。。。??急。求助!!


师兄:关于文本不知谁做过。。。。。谢谢  
   
  文本的格式为  
  001.txt  
  ----------------------  
  1111111   jkjkjlfjkj  
  3333333   lkdkjklkll  
  ............  
  --------------------  
  每一行都为一条记录,空格前后各为一字段内容  
   
  实现构想:以正常的方式来打开文件寻找...***.txt(都为以上格式)  
  从中取得每一行空格前后数据各放一字段存为一记录。。。  
   
  库中:  
  (id)     (num)         (text)  
    1     1111111           jkjkjlfjkj  
    2     3333333           lkdkjklkll  
   
  请问该如何实现空格前的判断;读取相关数据入库。。。。。。。。。。。  
   
  感谢!!!!!!!!!!!!!  
   
 

推荐阅读

  • Win98快速上网设置技巧 [详细内容]
  • 01.为图象添加太阳光 [详细内容]
  • 04.光照滤镜的学习 [详细内容]
  • 三星手机使用技巧 [详细内容]
  • 关于T408出现限制服务的处理方法 [详细内容]
  • 02.像素化滤镜制作冰晶字 [详细内容]
  • ACDSee32的使用技巧 [详细内容]
  • 网友回答:
    网友:zurong

    set     myfileobject=server.createobject(“scripting.filesystemobject”)      
      set     mytextfile=myfileobject.opentextfile(“c:\mydir\test.txt”)      
      while     not     mytextfile.atendofstream      
      str=mytextfile.readline    
      str1=split(str,"   ")  
      num=cint(str1(0))  
      text=str1(1)  
        .....  
      wend

    网友:lang11zi

    我也不懂。学习

    网友:wolf004

    <%  
      set   mfileobject=server.createobject("scripting.filesystemobject")  
      set   mfile=mfileobject.opentextfile("d:\story.txt")  
      while   not   mfile.atendofstream  
          response.write   "&nbsp;&nbsp;"   &   mfile.readline  
      wend  
      mfile.close  
      %>  
      这样是读一行,你把mfile.readline   改一下mfile.read试试

    网友:sephiroth0079

    sql   server   支持直接将文本文件导入到表中。

    网友:dgm8

    to:xianglong   (湘龙)       三楼的不行吗???  
       
      <%  
      set     myfileobject=server.createobject(“scripting.filesystemobject”)      
      set     mytextfile=myfileobject.opentextfile(“c:\mydir\test.txt”)      
      怎样去获得文件物理路径应该不会有问题吧?  
       
      i=0  
       
      while     not     mytextfile.atendofstream  
          str=split(mytextfile.readline,"   ")  
          snum(i)=cint(str(0))  
          stext(i)=str(1)  
       
          conn.execute   ("insert   into   tablename   (num,text)   values   ("&snum(i)&","&stext(i)&")")  
      最好把列名换一下,有可能是数据库的保留字  
      i=i+1  
      wend  
      %>  
       
       
       
        .....  
      wend

    .

    讨论区

    Login