gpt4 book ai didi

vbs生成ACCESS数据里所有表的字段

转载 作者:qq735679552 更新时间:2022-09-29 22:32:09 24 4
gpt4 key购买 nike

CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.

这篇CFSDN的博客文章vbs生成ACCESS数据里所有表的字段由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.

  1. <job id ="生成ACCESS数据库里所有表及所有字段并生成一定格式的字符组合">  
  2. <script language ="vbscript">  
  3. databasename ="access.mdb"''数据库地址  
  4. tablename ="blogarticle"''要处理的表名  
  5.  
  6.  
  7. Set conn = CreateObject("ADODB.Connection")  
  8. connstr ="provider=microsoft.jet.oledb.4.0;data source="&databasename  
  9. conn.Open connstr  
  10.  
  11. Set rs_all = CreateObject("adodb.recordset")  
  12. sql_all ="select name from MSysObjects where type=1 and flags=0"  
  13. rs_all.Open sql_all, conn,1,1  
  14.  
  15. DoWhileNot rs_all.EOF  
  16.     tablename = rs_all(0)  
  17. Set rs = CreateObject("adodb.recordset")  
  18.     sql ="select * from "& tablename &" where 1<>1"  
  19.     rs.Open sql, conn,1,1  
  20.     j = rs.Fields.Count  
  21.     txtContent =""  
  22.     txtContent1 =""  
  23.     txtContent2 =""  
  24.     txtContent3 =""  
  25.     txtContent4 =""  
  26. For i =0To(j -1)  
  27.         title = rs.Fields(i).Name  
  28.         txtContent = txtContent & title &"|"  
  29.         txtContent1 = txtContent1 & title&"=trim(request("""&title&"""))"&"<br>"  
  30.         txtContent2 = txtContent2 & title&"=rs("""&title&""")<br>"  
  31.         txtContent3 = txtContent3 &"rs("""&title&""")=trim(request("""&title&"""))<br>"  
  32.         txtContent4 = txtContent4 & title&"=rs("""&title&""")<br>"  
  33. Next  
  34.     yongfa365 ="<div align=center><a href=""http://www.yongfa365.com"" class=""titlink"" title=""柳永法(yongfa365)'Blog http://www.yongfa365.com"">柳永法(yongfa365)'Blog</a>制作</div>"&title&"里的字段<br><br>"  
  35.     CreateFile tablename&".html", yongfa365 & txtContent &"<br><br>"& txtContent1 &"<br><br>"& txtContent2 &"<br><br>"& txtContent3 &"<br><br>"& txtContent4  
  36.     rs_all.movenext  
  37. Loop  
  38.  
  39. Function CreateFile(FileName, Content)  
  40. Set FSO = CreateObject("Scripting.FileSystemObject")  
  41. Set fd = FSO.CreateTextFile(FileName,True)  
  42.     fd.WriteLine Content  
  43. EndFunction  
  44.  
  45. </script>  
  46. </job>  
  47.  
  48.  
  49. <job id ="生成ACCESS数据库里指定表的所有字段并生成一定格式的字符组合">  
  50. <script language ="vbscript">  
  51. databasename ="access.mdb"''数据库地址  
  52. tablename ="blogarticle"''要处理的表名  
  53.  
  54.  
  55. Set conn = CreateObject("ADODB.Connection")  
  56. connstr ="provider=microsoft.jet.oledb.4.0;data source="&databasename  
  57. conn.Open connstr  
  58.  
  59. ''Set rs_all = CreateObject("adodb.recordset")  
  60. ''sql_all = "select name from MSysObjects where type=1 and flags=0"  
  61. ''rs_all.Open sql_all, conn, 1, 1  
  62.  
  63. ''Do While Not rs_all.EOF  
  64. ''    tablename = rs_all(0)  
  65. Set rs = CreateObject("adodb.recordset")  
  66. sql ="select * from "& tablename &" where 1<>1"  
  67. rs.Open sql, conn,1,1  
  68. j = rs.Fields.Count  
  69. txtContent =""  
  70. txtContent1 =""  
  71. txtContent2 =""  
  72. txtContent3 =""  
  73. txtContent4 =""  
  74. For i =0To(j -1)  
  75.     title = rs.Fields(i).Name  
  76.     txtContent = txtContent & title &"|"  
  77.     txtContent1 = txtContent1 & title&"=trim(request("""&title&"""))"&"<br>"  
  78.     txtContent2 = txtContent2 & title&"=rs("""&title&""")<br>"  
  79.     txtContent3 = txtContent3 &"rs("""&title&""")=trim(request("""&title&"""))<br>"  
  80.     txtContent4 = txtContent4 & title&"=rs("""&title&""")<br>"  
  81. Next  
  82. yongfa365 ="<div align=center><a href=""http://www.yongfa365.com"" class=""titlink"" title=""柳永法(yongfa365)'Blog http://www.yongfa365.com"">柳永法(yongfa365)'Blog</a>制作</div>"&title&"里的字段<br><br>"  
  83. CreateFile tablename&".html", yongfa365 & txtContent &"<br><br>"& txtContent1 &"<br><br>"& txtContent2 &"<br><br>"& txtContent3 &"<br><br>"& txtContent4  
  84. ''    rs_all.movenext  
  85. ''Loop  
  86.  
  87. Function CreateFile(FileName, Content)  
  88. Set FSO = CreateObject("Scripting.FileSystemObject")  
  89. Set fd = FSO.CreateTextFile(FileName,True)  
  90.     fd.WriteLine Content  
  91. EndFunction  
  92.  
  93. </script>  
  94. </job>  

最后此篇关于vbs生成ACCESS数据里所有表的字段的文章就讲到这里了,如果你想了解更多关于vbs生成ACCESS数据里所有表的字段的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com