![]() |
#2
amshine2009-09-01 17:15
|

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www. xmlns="http://www. http-equiv="Content-Type" content="text/html; charset=gb2312" />
<%dim cn,rs
const connStr="Driver={SQL Server};uid=ta;database=epics;server=maindesk;"
public function cnopen()
set cn=server.CreateObject("adodb.connection")
cn.open connStr
If Err Then
err.Clear
Set cn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
end function
public function cnclose()
if typename(cn)="Connection" then
if cn.state<>0 then cn.close
set cn=nothing
end if
end function
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www. xmlns="http://www. http-equiv="Content-Type" content="text/html; charset=gb2312" />
<%dim cn,rs
const connStr="Driver={SQL Server};uid=ta;database=epics;server=maindesk;"
public function cnopen()
set cn=server.CreateObject("adodb.connection")
cn.open connStr
If Err Then
err.Clear
Set cn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
end function
public function cnclose()
if typename(cn)="Connection" then
if cn.state<>0 then cn.close
set cn=nothing
end if
end function
%>
[ 本帖最后由 amshine 于 2009-9-2 10:03 编辑 ]