您的位置:首页 > 编程语言 > ASP

ASP 一分钟=半天 之,自动生成:username=trim(request("username"))......功能"指引性"超强

2006-05-30 19:15 567 查看
<!--本软件的诞生的原因:证明:只要你用心,那么:一分种 <=> 半天-->
<title>一分钟=半天</title>
<style type="text/css">
<!--
.STYLE1 {color: #FFFFFF}
body,td,th {
font-family: 宋体;
font-size: 14px;
}
.STYLE2 {color: #FFFF00}
-->
</style>
<%
action=trim(request("action"))
username=trim(request("username"))
password=trim(request("password"))
ip=trim(request("ip"))
tablename=trim(request("tablename"))
dataname=trim(request("dataname"))
selname=trim(request("selname"))
%>
<%if action="" then %>
<div>
<form name="form1" method="post" action="?action=two">
<table width="277" height="225" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" bgcolor="#000000">
<tr>
<td height="62" colspan="2"><table width="100%">
<tr>
<td height="25" class="STYLE1"><div align="center" class="STYLE2">中科新网初级程序设计师--柳永法制作</div></td>
</tr>
<tr>
<td height="25" class="STYLE1"><label>
<div align="center">
<input name="selname" type="radio" value="access" checked>
Access    
<input type="radio" name="selname" value="sqlserver">
SQL Server</div>
</label></td>
</tr>
<tr>
<td height="25" class="STYLE1"> </td>
</tr>
</table></td>
</tr>
<tr>
<td width="70" height="25"><div align="right"><span class="STYLE1">UserName:</span></div></td>
<td width="204" height="25"><input name="username" type="text" id="username" size="25"></td>
</tr>
<tr>
<td height="25"><div align="right"><span class="STYLE1">Password:</span></div></td>
<td height="25"><input name="password" type="text" id="password" size="25"></td>
</tr>
<tr>
<td height="25"><div align="right"><span class="STYLE1">IP:</span></div></td>
<td height="25"><input name="ip" type="text" id="ip" size="25"></td>
</tr>
<tr>
<td height="25"><div align="right"><span class="STYLE1">TableName:</span></div></td>
<td height="25"><input name="tablename" type="text" id="tablename" value="joke" size="25"></td>
</tr>
<tr>
<td height="25"><div align="right" class="STYLE1">DataName:</div></td>
<td height="25"><input name="dataname" type="text" id="dataname" value="joke.mdb" size="25"></td>
</tr>
<tr>
<td height="45" colspan="2"><div align="center"><span class="STYLE1">
<input type="submit" name="Submit" value="提交">
  
<input type="reset" name="Submit2" value="重置">
</span></div></td>
</tr>
</table>
</form>
</div>
<%end if%>
<%if action="two" then %>
<div>
<%
Set fso= Server.CreateObject("Scripting.FileSystemObject")
set fd=fso.createtextfile(server.MapPath(""&tablename&"字段信息.html"),true)
Set conn = Server.CreateObject("ADODB.Connection")
if selname="access" then
connstr="DBQ="+server.mappath(""&dataname&"")+";DRIVER={Microsoft Access Driver (*.mdb)};"
elseif selname="sqlserver" then
connstr="Provider=SQLOLEDB.1; Persist Security Info=True; Data Source=" & ip & "; Initial Catalog="&dataname&"; User ID="&UserName&"; Password=" & password
end if
conn.open connstr
set rs=server.CreateObject("adodb.recordset")
sql="select * from "& tablename &" where 1<>1"
rs.open sql,conn,1,1
j=rs.Fields.count
str= "<font color=red> <center>很高兴这个小小程序能给您的工作带来方便。</center></font><br><font color=red> <center>作者:柳永法QQ:64049027。</center></font><br><title>"&tablename&"字段信息--柳永法制作</title>"
response.Write str
fd.writeline str
'开始操作
str="本信息已经写入此程序所在文件夹下<font color=red>"""&tablename&"字段信息.html"""&"</font>内<br><br>"
response.Write str
fd.writeline str
for i=0 to (j-1)
title=rs.Fields(i).Name
str= title&"=trim(request("""&title&"""))"&"<br>"
response.Write str
fd.writeline str
Next

fd.writeline "<br>"

response.Write"<P>"
for i=0 to (j-1)
title=rs.Fields(i).Name
str="rs("""&title&""")="&title&"<br>"
str=title&"=rs("""&title&""")<br>"
response.Write str
fd.writeline str
Next

fd.writeline "<br>"

response.Write"<P>"
for i=0 to (j-1)
title=rs.Fields(i).Name
str= "rs("""&title&""")=trim(request("""&title&"""))<br>"
response.Write str
fd.writeline str
Next

fd.writeline "<br>"

response.Write"<P>"
for i=0 to (j-1)
title=rs.Fields(i).Name
str=title&"=rs("""&title&""")<br>"
response.Write str
fd.writeline str
Next

rs.close
%>
</div>
<%end if%>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐