国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

一個簡單的SQL語句執(zhí)行器

2019-11-18 20:24:17
字體:
供稿:網(wǎng)友
大至分為三個文件:ljmdb.asp(連接庫文件)、entice.asp(sql語句執(zhí)行主界面)、entice2.asp(select記錄集)

====================================ljmdb.asp
<%
set conndb=server.createobject("ADODB.CONNECTION")
constr="PRovider=microsoft.jet.oledb.4.0;data

source="&server.mappath("/aspsky.myip.org/entice.mdb")
conndb.open constr
%>
'這是連接access的,把數(shù)據(jù)庫的地址改成你自己的地址就行了

====================================entice.asp
<%
if left(trim(request("sqllanguage")),6)="select" then
%>
<script language=javascript>
window.open("entice2.asp?sql=<%=request("sqllanguage")%>","","height=450,width=600,resizable=yes,

scrollbars=yes,status=no,toolbar=no,menubar=no,location=no")
</script>
<%
end if
%>
<!--#include file=ljmdb.asp-->
<%
%>
<HTML>
<Title>SOL語句執(zhí)行示例 </Title>
<style type="text/CSS">
<!--
body { font-size: 12px}
table { font-size: 12px}
-->
</style>
<Body Bgcolor=#009999>
<%
sqllanguage=Request("sqllanguage")
%>
<Form Name="FormPst" Method="Post" Action="entice.asp">
<div align="center"><FieldSet> <Legend>請輸入SQL語句</Legend> 指令:
<Input type="text" name="sqllanguage" Size=60>
<Input type="Submit" Value="送出">
</FieldSet> </div>
</form>
<Hr>
SQL 語句執(zhí)行情況:

<%
if sqllanguage<>Empty then
On Error Resume Next
conndb.Execute(sqllanguage)
if err.number="0" then
message1="執(zhí)行成功"
response.write message1
else
message1=err.description
response.write message1
err.clear
end if
end if
%>



<%
set rstable=conndb.openSchema(20)
rstable.movefirst
%>
<table width="95%" border="0" cellspacing="1" cellpadding="3" align="center" bgcolor="#000000">
<%
do while not rstable.eof
if rstable("table_type")="TABLE" then
%>
<tr bgcolor="#006400">
<td width="18%" nowrap><font color="#FFFFFF">數(shù)據(jù)庫中的表名</font></td>
<td width="82%" nowrap> <font color="#FFFFFF">
<%

response.write rstable("table_name")
%>
</font></td>
</tr>
<tr bgcolor="#CCCCCC">
<td width="18%" nowrap>該表中的所有字段</td>
<td width="82%" nowrap>
<%
set rstobj=server.createobject("adodb.recordset")
rstsql="select * from "&rstable("table_name")
rstobj.open rstsql,conndb,1
for i=0 to rstobj.fields.count-1
response.write rstobj(i).name&"|"
next
rstobj.close
set rstobj=nothing
%>
</td>
</tr>
<%
end if
rstable.movenext
loop
rstable.close
set rstable=nothing
%>
</table>
</Body>
</HTML>
<%
conndb.close
set conndb=nothing
%>


=====================================entice2.asp
<Title>select查詢器====entice</Title>
<style type="text/css">
<!--
body { font-size: 12px}
table { font-size: 12px}
-->
</style>

<Body Bgcolor=#009999>
<!--#include file=ljmdb.asp-->
<%
rstsql=request("sql")
response.write "你的查詢語句為:"&rstsql&"
下面是您所查詢的記錄集"
set rstobj=server.createobject("adodb.recordset")
rstobj.open rstsql,conndb,1
response.write ",共查到"&rstobj.recordcount&"條記錄"
fcount=rstobj.fields.count
response.write "<table width='98%' border='0' cellspacing='1' cellpadding='3' align='center'

bgcolor='#000000'><tr bgcolor='#006400'>"
for i=0 to fcount-1
response.write "<td><font color='ffffff'>"&rstobj(i).name&"</font></td>"
next
response.write "</tr>"
do while not rstobj.eof
response.write "<tr bgcolor='#cccccc'>"
for i=0 to fcount-1
response.write "<td>"&rstobj(i)&"</td>"
next
response.write "</tr>"
rstobj.movenext
loop
response.write "</table>"
rstobj.close
set rstobj=nothing
conndb.close
set conndb=nothing
%>


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 潼南县| 乌恰县| 邓州市| 黄骅市| 开原市| 宜春市| 临泽县| 东乡族自治县| 林周县| 金秀| 西充县| 衡阳县| 邹城市| 宣城市| 安平县| 峨山| 厦门市| 宜兰市| 邹平县| 丰宁| 黄冈市| 海原县| 伊春市| 西宁市| 顺义区| 五大连池市| 卢龙县| 绍兴县| 曲松县| 教育| 安溪县| 曲阜市| 临朐县| 瑞昌市| 舞阳县| 双辽市| 张北县| 天全县| 漳浦县| 南木林县| 淄博市|