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

<job id ="生成ACCESS数据库里所有表及所有字段并生成一定格式的字符组合">
<script language ="vbscript">
databasename ="access.mdb"''数据库地址
tablename ="blogarticle"''要处理的表名

Set conn = CreateObject("ADODB.Connection")
connstr ="provider=microsoft.jet.oledb.4.0;data source="&databasename
conn.Open connstr

Set rs_all = CreateObject("adodb.recordset")
sql_all ="select name from MSysObjects where type=1 and flags=0"
rs_all.Open sql_all, conn,1,1

DoWhileNot rs_all.EOF
    tablename = rs_all(0)
Set rs = CreateObject("adodb.recordset")
    sql ="select * from "& tablename &" where 1<>1"
    rs.Open sql, conn,1,1
    j = rs.Fields.Count
    txtContent =""
    txtContent1 =""
    txtContent2 =""
    txtContent3 =""
    txtContent4 =""
For i =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 ="<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>"
    CreateFile tablename&".html", yongfa365 & txtContent &"<br><br>"& txtContent1 &"<br><br>"& txtContent2 &"<br><br>"& txtContent3 &"<br><br>"& txtContent4
    rs_all.movenext
Loop

Function CreateFile(FileName, Content)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set fd = FSO.CreateTextFile(FileName,True)
    fd.WriteLine Content
EndFunction

</script>
</job>

<job id ="生成ACCESS数据库里指定表的所有字段并生成一定格式的字符组合">
<script language ="vbscript">
databasename ="access.mdb"''数据库地址
tablename ="blogarticle"''要处理的表名

Set conn = CreateObject("ADODB.Connection")
connstr ="provider=microsoft.jet.oledb.4.0;data source="&databasename
conn.Open connstr

''Set rs_all = CreateObject("adodb.recordset")
''sql_all = "select name from MSysObjects where type=1 and flags=0"
''rs_all.Open sql_all, conn, 1, 1

''Do While Not rs_all.EOF
''    tablename = rs_all(0)
Set rs = CreateObject("adodb.recordset")
sql ="select * from "& tablename &" where 1<>1"
rs.Open sql, conn,1,1
j = rs.Fields.Count
txtContent =""
txtContent1 =""
txtContent2 =""
txtContent3 =""
txtContent4 =""
For i =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 ="<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>"
CreateFile tablename&".html", yongfa365 & txtContent &"<br><br>"& txtContent1 &"<br><br>"& txtContent2 &"<br><br>"& txtContent3 &"<br><br>"& txtContent4
''    rs_all.movenext
''Loop

Function CreateFile(FileName, Content)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set fd = FSO.CreateTextFile(FileName,True)
    fd.WriteLine Content
EndFunction

</script>
</job>

时间: 2024-08-01 21:35:18

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

关于vbs 生成静态页面过程中出现的问题_vbs

vbs是否能够实现如下的:访问某个aspx页面,然后把服务器返回的页面以filestream 的形式保存为html格式,如果可以实现,应该如何来用代码来实现呢? 先用InternetExplorer.Application打开http://xxx.xxx.xxx/xxx.aspx,然后保存oIE.document.body.outerHTML就可以了!! 例如如下代码细节: VBScript code: 复制代码 代码如下: Set oIE = CreateObject("InternetExp

如何通过asp.net将ACCESS数据库里的2张表导入到SQLserver数据库里

问题描述 如何通过asp.net将ACCESS数据库里的2张表导入到SQLserver数据库里点一个按钮将ACCESS数据库里的表导入到SQLServer数据库中可以是临时表我这样的目的是方便读取数据库感觉这样做好操作一点!希望高手可以把关键代码写出来谢谢了 解决方案 解决方案二:妈哟,为什么没有来回答我的问题啊???????????????解决方案三:你把ACCESS数据表里面的数据读取出来.然后再写进SQL里撒...解决方案四:我知道这个原理,但实现不是很了解有实际的代码吗?或者关键字的代码

怎么用程序实现在sql Server中按要求选择几个表生成Access数据库,并能把表中的数据也同时生成.

问题描述 怎么用程序实现在sqlServer中按要求选择几个表生成Access数据库,并能把表中的数据也同时生成.

从Linux上的DB2表生成动态数据表单

简介: 本文使用 Linux 上的 Kylix 3 和 Borland dbExpress 数据访问驱动程序来分析 DB2 UDB 数 据库表.字段(名称和类型),从而允许用户选择特定的表.来回切换应该显示的字段,以及动态查看数 据表格和单个数据感知控件的输出. 简介 在本文中,为了动态构建视图和表单,我将检查 DB2 Universal Database (UDB) 元数据.特别是,我将使用 Linux 上的 Kylix 3 和 Borland dbExpress 数据访问驱动程序,来分析 D

反射-java代码实现生成一套表中的数据,包括表的关联关系

问题描述 java代码实现生成一套表中的数据,包括表的关联关系 在a表中生成一套a表中的数据,只是一个字段值不一样而已,并且还要生成表的关系关系 相当于在原来表关系的基础上在生成一套新的数据.

用c#把数据提交到相关联的两张access数据表中

问题描述 用c#把数据提交到相关联的两张access数据表中 现在要把姓名.密码.学号.性别添加到数据库表中,现在有两个表:账号表和信息表,要把姓名.密码添加到账号表,把姓名学号性别添加到信息表,两张表有建立关系,账号表中的姓名是主键,用c#语言怎么把文本框中的信息添加到两张表中,求大神帮帮忙,最好有代码看看,谢谢了protected void Button1_Click(object sender, EventArgs e) { string TID = TextBox1.Text.ToStr

sql-怎么使用SQL修改access数据库库表结构

问题描述 怎么使用SQL修改access数据库库表结构 怎么使用SQL修改access数据库库表结构(改动较大),同时避开表之间的关系连接,改动包括新增字段.修改字段长度.新增表 解决方案 根据sql脚本修改数据库表结构SQL语句修改数据库表结构修改SQL-SERVER数据库表结构的SQL命令 解决方案二: 删除表: Drop table [表名] 插入数据: INSERT INTO 表名 VALUES (100,'51WINDOWS.NET') 删除数据: DELETE FROM [表名] W

insert-c++中将access数据导入foxpro时,只能导入每个表中的第一行数据

问题描述 c++中将access数据导入foxpro时,只能导入每个表中的第一行数据 导入数据时可以读取第一行数据并导入成功,读取第二行后不能导入. 代码如下: CString strSQL("insert into test(i_name, j_name) values("); while (!pRecordset->EndOfFile) { CString strId; strId.Format("%s",(const char *)(_bstr_t)(p

c#-C#怎么实现蒋2个MDB里的数据导入。A表数据导入B表求代码

问题描述 C#怎么实现蒋2个MDB里的数据导入.A表数据导入B表求代码 C#怎么实现蒋2个MDB里的数据导入.A表数据导入B表求代码 解决方案 分别创建俩个数据库连接,连接A连接将A表数据取出读到缓存里,然后连接B连接循环将A数据插入B表 取数到dataTable,或者对象中循环.代码不复杂, public static SqlConnection connection; #region 数据源连接 public static SqlConnection Connection { get { t