ASP连接SQL数据库conn.asp出错的写法怎么写?
VBScript code:
<%
dim conns
dim connstrs
on error resume next
connstrs ="PROVIDER=SQLOLEDB;DATA SOURCE="&ipaddr&";UID="&uid&";PWD="&pwd&";DATABASE="&database&" "
set conns=server.createobject("ADODB.CONNECTION")
if err then
'err.clear
Set conns = Nothing
response.write"<script>alert('连接软件数据库出错,请先配置好数据库!');location.href='System.asp'</script>"
Response.End
else
conns.open connstrs
end if
%>
执行上面代码之后怎么不执行弹出“连接软件数据库出错,请先配置好数据库!”???
是不是哪里代码写错了?
我想达到的目的就是:如果连接SQL数据库的数据源地址,数据库名,数据库密码任何一个出错了,意思就是无法正常连接到指定的SQL数据库时就提示此窗口并转到配置数据库的页面来。
谢谢大家了!!!
谢谢楼上的yan11cn
相关问答:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
function CheckOpwd(){//验证用户名
var pwd=document.all.txtOpwd;
var div1=document.getElementById("divPwd");
if (pwd.value=="")
{
......
现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......
如何在SQL2005中设定定时作业,比如说定时清理某些表的数据,
或者是定时的将某些表的数据导出excel!
在线等待,急急急,最好是详细步骤!
之前我做的作业有点问题!
帮UP
参考:http://hi.baidu.com/toiota ......