asp 輔助工具(hta版)
來(lái)源:易賢網(wǎng) 閱讀:921 次 日期:2016-06-22 09:11:36
溫馨提示:易賢網(wǎng)小編為您整理了“asp 輔助工具(hta版)”,方便廣大網(wǎng)友查閱!

使用方法:保存為asptools.hta然后再運(yùn)行

代碼如下:

<!doctype html public -//w3c//dtd xhtml 1.0 transitional//en http://www.w3.org/tr/xhtml1/dtd/xhtml1-

transitional.dtd>

<html xmlns=http://www.w3.org/1999/xhtml>

<head>

<meta http-equiv=content-type content=text/html; charset=gb2312 />

<meta name=author content=柳永法 />

<title>asp輔助工具</title>

<style>body{ font-size:12px}</style>

<hta:application

id=asptools

applicationname=asptools

scroll=no

singleinstance=yes

windowstate=normal

>

</head>

<body>

<div>

<input type=file id=txtfile onchange=createtableselect('access') style=display:none />

ip:<input type=text name=ip size=16 style=border:1px solid green value=.\sql2005 />

登錄名:<input type=text name=userid size=10 style=border:1px solid green value=sa />

密碼:<input type=password name=pwd size=10 style=border:1px solid green value=yongfa365 />

數(shù)據(jù)庫(kù)名:<input type=text name=dbname size=10 style=border:1px solid green value=hb605-8-8 /><br />

<input name=button2 type=button id=button2 style=border:1px solid green onclick=createtableselect

('mssql') value=連接sql數(shù)據(jù)庫(kù) />

<input type=button id=btnfromfile onclick=txtfile.click() value=連接access數(shù)據(jù)庫(kù) style=border:1px solid

green />

<span id=tables ></span>

<hr />

模板:

<input type=text id=opt value= size=40 />

<select size=1 id=fz onchange=opt.value=this.value style=width:200px></select>

<input name=button type=button id=button onclick=c() value=轉(zhuǎn)換 style=border:1px solid green>

<hr />

<textarea id=s rows=10 cols=80 style=width:98%></textarea>

<input type=button onclick=madesql() value=生成sql語(yǔ)句 style=border:1px solid green />

<textarea id=d rows=10 cols=80 style=width:98%></textarea>

</div>

<pre id=sqldemo style=display:none intro=通用建表結(jié)構(gòu)>

--通用建表結(jié)構(gòu)

create table [dbo].[tablename] (

[id] int primary key identity(1,1),--id,主鍵,自動(dòng)號(hào)

[txttitle] varchar(255),--標(biāo)題

[txtcontent] text,--內(nèi)容

[puttime] datetime default (getdate()),--提交時(shí)間

[moditime] datetime default (getdate()),--修改時(shí)間

[hits] int default (0),--點(diǎn)擊數(shù)

[flags] int default (0) ,--標(biāo)識(shí)

[orderid] int default (0),--排序號(hào)

)

</pre>

<pre id=sdemo style=display:none intro=初始源測(cè)試數(shù)據(jù)>

username

password

sex

truename

age

tel

msn

qq

email

</pre>

<pre id=fzdemo style=display:none intro=輔助輸入>

輔助輸入

rs($1) = request($1)

rs($1) = saferequest($1)

$1 = request($1)

$1 = saferequest($1)

<tr><td>$1:</td><td><input type=text name=$1 size=20></td></tr>

</pre>

<hr />

建議查看源文件然后保存為asptools.hta然后再運(yùn)行

<script language=vbscript type=text/vbscript>

self.focus()

self.resizeto 620, 520

'初始化數(shù)據(jù)

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

'程序運(yùn)行時(shí)的一些函數(shù)

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 '定義全局變量,避免重復(fù)鏈接數(shù)據(jù)庫(kù)。

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 & <option value='& xtable.name &'>& xtable.name &</option>

end if

next

tables.innerhtml =  <select name='nowtables' onchange='createfieldselect( & dbtype & )'><option>==請(qǐng)選擇

表名==</option> & tabless & </select>

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

</script>

</body>

</html>

更多信息請(qǐng)查看腳本欄目
易賢網(wǎng)手機(jī)網(wǎng)站地址:asp 輔助工具(hta版)
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢(xún)回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門(mén)公布的正式信息和咨詢(xún)?yōu)闇?zhǔn)!

2025國(guó)考·省考課程試聽(tīng)報(bào)名

  • 報(bào)班類(lèi)型
  • 姓名
  • 手機(jī)號(hào)
  • 驗(yàn)證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢(xún) | 簡(jiǎn)要咨詢(xún)須知 | 加入群交流 | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
云南網(wǎng)警備案專(zhuān)用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢(xún)關(guān)注公眾號(hào):hfpxwx
咨詢(xún)QQ:526150442(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報(bào)警專(zhuān)用圖標(biāo)