使用方法:保存为asptools.hta然后再运行
代码如下:
transitional.dtd>
id=asptools applicationname=asptools scroll=no singleinstance=yes windowstate=normal >
ip:
登录名:
密码:
数据库名:
('mssql') value=连接sql数据库 />
green />
模板:
建议查看源文件然后保存为asptools.hta然后再运行
self.focus()
self.resizeto 620, 520
'初始化数据
s.value = sdemo.innerhtml
fzs = split(fzdemo.innerhtml, vbcrlf)
for each opttemp in fzs
set o = document.createelement(option)
o.text = opttemp
o.value = opttemp
fz.add o
next
opt.value = fz.options(1).value
'程序运行时的一些函数
function c()
ss = split(s.value, vbcrlf)
for each sss in ss
if sss<> then str = str & replace(opt.value, $1, sss) & vbcrlf
next
d.value = str
end function
dim xcat '定义全局变量,避免重复链接数据库。
function createtableselect(dbtype)
set xcat = createobject(adox.catalog)
if dbtype = access then
xcat.activeconnection = provider=microsoft.jet.oledb.4.0;data source= & txtfile.value
elseif dbtype = mssql then
xcat.activeconnection = provider=sqloledb.1; persist security info=true; data source= & ip.value & ;
initial catalog=& dbname.value &; user id=& userid.value &; password= & pwd.value
end if
for each xtable in xcat.tables
tabletype = xtable.type
if tabletype = table then
tabless = tabless &
end if
next
tables.innerhtml =
表名== & tabless &
end function
function createfieldselect(dbtype)
dim item
for each xtable in xcat.tables
if xtable.name = nowtables.value then
for each item in xtable.columns
str = str + item.name & vbcrlf
next
exit for
end if
next
s.value = left(str, len(str) -2)
end function
function madesql()
yongfa365fields = split(s.value, vbcrlf)
yongfa365code2 =
for each sql in yongfa365fields
if sql<> then strsql = strsql & [ & sql & ] varchar(50),
next
strsql = left(strsql, len(strsql) -1)
yongfa365code2 = create table tablename( & vbcrlf & replace(strsql, ,, , & vbcrlf) & vbcrlf & ) & vbcrlf
& vbcrlf
tempvalue = join(yongfa365fields, & ',' & objitem.)
yongfa365code2 = yongfa365code2 & conn.execute insert into info ( & join(yongfa365fields, ,) & ) values
(' & objitem. & tempvalue & & ') & vbcrlf & vbcrlf & vbcrlf
tempvalue = join(yongfa365fields, ) & ',' & rs()
yongfa365code2 = yongfa365code2 & conn.execute insert into info ( & join(yongfa365fields, ,) & ) values
(' & rs( & tempvalue & ) & ') & vbcrlf & vbcrlf & vbcrlf
tempvalue = join(yongfa365fields, & ',' & )
yongfa365code2 = yongfa365code2 & conn.execute insert into info ( & join(yongfa365fields, ,) & ) values
(' & & tempvalue & & ') & vbcrlf & vbcrlf & vbcrlf
d.value = sqldemo.innerhtml & string(2, vbcrlf) & yongfa365code2
end function
function rereplace(str, restrs, restrd)
set re = new regexp
re.ignorecase = true
re.global = true
re.pattern = restrs
rereplace = re.replace(str, restrd)
end function