怎么sql语句错了 不报错 还继续执行?
生活随笔
收集整理的這篇文章主要介紹了
怎么sql语句错了 不报错 还继续执行?
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
<html?xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta?http-equiv="Content-Type"?content="text/html;?charset=gb2312"?/>
<title>無標(biāo)題文檔</title>
<link?href="fyjs.css"?rel="stylesheet"?type="text/css"?/>
</head>
<body>
<form?action="select.asp"?method="post">
<input?name="chaxu"?type="text"?size="100"???/>?
<input?type="submit"?name="send"?value="查詢"/><div></div></form>
<%
dim?chaxu,send,sql,conn
set?conn?=server.CreateObject("adodb.connection")
conn.open?"driver={sql?server};server=xh-003cdf2697;database=test;uid=sa;pwd=sa;"
response.Write?"ok"&"<br/>"
chaxu=trim(request("chaxu"))
send=request("send")
if?chaxu<>""?then?
sql=chaxu
response.Write?sql
else?
'response.Write?sql
response.End
end?if
on?error?resume?next??
set?rs?=?server.createobject("adodb.recordset")
rs.open?sql,conn,1,1
if?err.number>0?then
response.write?err.number&"<font?color=red><br>"
'判斷sql語句執(zhí)行情況
response.write?err.description&"</font>"
response.End
end?if
%>?
?
<table?width="800"?border="1"?align="center"?cellpadding="10"?cellspacing="0">
<tr>
<%
for?i=0?to?rs.fields.count-1
%>
<th><%=rs.Fields(i).name%></th>
<%
next
%>
</tr>
<%do?while?not?rs.eof%>
<!--循環(huán)內(nèi)容-->
<tr>
<%
?for?i=0?to??rs.fields.count-1
??%>
<th><%=rs.Fields(i).value%></th>
<%next%>
</tr>
<%
rs.movenext
loop
%>
</table>
<%
conn.close
set?conn=nothing
set?rs=nothing
%>
</body>
</html>
<head>
<meta?http-equiv="Content-Type"?content="text/html;?charset=gb2312"?/>
<title>無標(biāo)題文檔</title>
<link?href="fyjs.css"?rel="stylesheet"?type="text/css"?/>
</head>
<body>
<form?action="select.asp"?method="post">
<input?name="chaxu"?type="text"?size="100"???/>?
<input?type="submit"?name="send"?value="查詢"/><div></div></form>
<%
dim?chaxu,send,sql,conn
set?conn?=server.CreateObject("adodb.connection")
conn.open?"driver={sql?server};server=xh-003cdf2697;database=test;uid=sa;pwd=sa;"
response.Write?"ok"&"<br/>"
chaxu=trim(request("chaxu"))
send=request("send")
if?chaxu<>""?then?
sql=chaxu
response.Write?sql
else?
'response.Write?sql
response.End
end?if
on?error?resume?next??
set?rs?=?server.createobject("adodb.recordset")
rs.open?sql,conn,1,1
if?err.number>0?then
response.write?err.number&"<font?color=red><br>"
'判斷sql語句執(zhí)行情況
response.write?err.description&"</font>"
response.End
end?if
%>?
?
<table?width="800"?border="1"?align="center"?cellpadding="10"?cellspacing="0">
<tr>
<%
for?i=0?to?rs.fields.count-1
%>
<th><%=rs.Fields(i).name%></th>
<%
next
%>
</tr>
<%do?while?not?rs.eof%>
<!--循環(huán)內(nèi)容-->
<tr>
<%
?for?i=0?to??rs.fields.count-1
??%>
<th><%=rs.Fields(i).value%></th>
<%next%>
</tr>
<%
rs.movenext
loop
%>
</table>
<%
conn.close
set?conn=nothing
set?rs=nothing
%>
</body>
</html>
總結(jié)
以上是生活随笔為你收集整理的怎么sql语句错了 不报错 还继续执行?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2010南非世界杯小结贴
- 下一篇: 检索逐小时空气质量数据