如何便得文件夹中文件与数据表记录中保持一致?谢谢各位了

来源:互联网 发布:无线路由访客网络 编辑:程序博客网 时间:2024/05/19 01:10
下面代码是读取文件夹中文件并写入数据表中
但现在存在一个问题如何确保与数据表记录中保持一致,也就是当写入数据表时,若数据表记录已经存在则不添加,否则将文件名添加到数据表中,若文件不存在而数据表中有记录则清除记录该,总之就是“文件夹中文件与数据表记录中保持一致”~!

<!-- #include file="conn.asp" -->
<!-- #include file="../yhqx.asp" -->
<%
  TruePath=Server.MapPath("htxt_bb")   
  set fso=CreateObject("Scripting.FileSystemObject")   
  Set theFolder=fso.GetFolder(TruePath)   
  i = 1   
  For Each theFile In theFolder.Files   
  'Response.write("第"&i&"个<br>")   
  Response.write(""&i&"、"&theFile.Name&"<br>")   
  i = i+1   
  Next   
  For Each theFile In theFolder.Files  
dim path
path=TheFile.Name
  sql = "insert into htxt_bb(ht_bb_1)values('"&path&"')"   
  Conn.execute(sql)   
  Next
%>

0 0
原创粉丝点击