手机
当前位置:查字典教程网 >脚本专栏 >vbs >vbs生成ACCESS数据里所有表的字段
vbs生成ACCESS数据里所有表的字段
摘要:databasename="access.mdb"''数据库地址tablename="blogarticle"''要处理的表名Setconn...

<jobid="生成ACCESS数据库里所有表及所有字段并生成一定格式的字符组合">

<scriptlanguage="vbscript">

databasename="access.mdb"''数据库地址

tablename="blogarticle"''要处理的表名

Setconn=CreateObject("ADODB.Connection")

connstr="provider=microsoft.jet.oledb.4.0;datasource="&databasename

conn.Openconnstr

Setrs_all=CreateObject("adodb.recordset")

sql_all="selectnamefromMSysObjectswheretype=1andflags=0"

rs_all.Opensql_all,conn,1,1

DoWhileNotrs_all.EOF

tablename=rs_all(0)

Setrs=CreateObject("adodb.recordset")

sql="select*from"&tablename&"where1<>1"

rs.Opensql,conn,1,1

j=rs.Fields.Count

txtContent=""

txtContent1=""

txtContent2=""

txtContent3=""

txtContent4=""

Fori=0To(j-1)

title=rs.Fields(i).Name

txtContent=txtContent&title&"|"

txtContent1=txtContent1&title&"=trim(request("""&title&"""))"&"<br>"

txtContent2=txtContent2&title&"=rs("""&title&""")<br>"

txtContent3=txtContent3&"rs("""&title&""")=trim(request("""&title&"""))<br>"

txtContent4=txtContent4&title&"=rs("""&title&""")<br>"

Next

yongfa365="<divalign=center><ahref=""http://www.yongfa365.com""class=""titlink""title=""柳永法(yongfa365)'Bloghttp://www.yongfa365.com"">柳永法(yongfa365)'Blog</a>制作</div>"&title&"里的字段<br><br>"

CreateFiletablename&".html",yongfa365&txtContent&"<br><br>"&txtContent1&"<br><br>"&txtContent2&"<br><br>"&txtContent3&"<br><br>"&txtContent4

rs_all.movenext

Loop

FunctionCreateFile(FileName,Content)

SetFSO=CreateObject("Scripting.FileSystemObject")

Setfd=FSO.CreateTextFile(FileName,True)

fd.WriteLineContent

EndFunction

</script>

</job>

<jobid="生成ACCESS数据库里指定表的所有字段并生成一定格式的字符组合">

<scriptlanguage="vbscript">

databasename="access.mdb"''数据库地址

tablename="blogarticle"''要处理的表名

Setconn=CreateObject("ADODB.Connection")

connstr="provider=microsoft.jet.oledb.4.0;datasource="&databasename

conn.Openconnstr

''Setrs_all=CreateObject("adodb.recordset")

''sql_all="selectnamefromMSysObjectswheretype=1andflags=0"

''rs_all.Opensql_all,conn,1,1

''DoWhileNotrs_all.EOF

''tablename=rs_all(0)

Setrs=CreateObject("adodb.recordset")

sql="select*from"&tablename&"where1<>1"

rs.Opensql,conn,1,1

j=rs.Fields.Count

txtContent=""

txtContent1=""

txtContent2=""

txtContent3=""

txtContent4=""

Fori=0To(j-1)

title=rs.Fields(i).Name

txtContent=txtContent&title&"|"

txtContent1=txtContent1&title&"=trim(request("""&title&"""))"&"<br>"

txtContent2=txtContent2&title&"=rs("""&title&""")<br>"

txtContent3=txtContent3&"rs("""&title&""")=trim(request("""&title&"""))<br>"

txtContent4=txtContent4&title&"=rs("""&title&""")<br>"

Next

yongfa365="<divalign=center><ahref=""http://www.yongfa365.com""class=""titlink""title=""柳永法(yongfa365)'Bloghttp://www.yongfa365.com"">柳永法(yongfa365)'Blog</a>制作</div>"&title&"里的字段<br><br>"

CreateFiletablename&".html",yongfa365&txtContent&"<br><br>"&txtContent1&"<br><br>"&txtContent2&"<br><br>"&txtContent3&"<br><br>"&txtContent4

''rs_all.movenext

''Loop

FunctionCreateFile(FileName,Content)

SetFSO=CreateObject("Scripting.FileSystemObject")

Setfd=FSO.CreateTextFile(FileName,True)

fd.WriteLineContent

EndFunction

</script>

</job>

【vbs生成ACCESS数据里所有表的字段】相关文章:

VBS教程:VBScript 语句-Rem 语句

用vbs实现配置静态 IP 地址

VBS教程:VBscript语句-Call 语句

用vbs找到映射到共享的所有驱动器并重新映射它们

reg2vbs.vbs 将Reg文件转换为VBS文件保存 脚本之家修正版本

脚本编程3 关于文件的读写

Vbscript写注册表的方法

用vbs 取得收藏夹里的所有链接名称和URL的脚本

vbs adox提取数据库表名和列名的类

vbs删除注册表项的代码

精品推荐
分类导航