日期:2014-05-16 浏览次数:21105 次
<% response.charset="gb2312" %>
Response.Buffer=True
Response.ExpiresAbsolute=Now()-1
Response.Expires=0
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "No-Cache"
Server.ScriptTimeout=90
dim ConnStr2
dim conn2,cpaZK
dim DatabaseType
DatabaseType="SQL"
On Error Resume Next
ConnStr2 = "DRIVER={SQL Server};SERVER=173.208.234.xxx;UID=a03022014xxx;PWD=xxxx;DATABASE=xxxx;"
Set conn2 = Server.CreateObject("ADODB.Connection")
conn2.Open connstr2
If Err Then
err.Clear
Set Conn2 = Nothing
Response.Write "数据库连接出错,请检查Conn2.asp文件中的数据库参数设置。"
Response.End
End If
%>
<%sub CloseConn2()
On Error Resume Next
If IsObject(Conn2) Then
conn2.close
set conn2=nothing
end if
end sub
%>
<!--#include file="conn2.asp"-->
<% set rs=server.CreateObject("adodb.recordset")
rs.open "select top 1 * form user8",conn2,1,1
us=rs("uname")
rs.Close
set rs=nothing%>
<a><%=us%></a>
<%
on error resume next
Dim sql_databasename,sql_password,sql_username,sql_localname
sql_localname = "(local)"
sql_databasename = "数据库名"
sql_username = "用户名"
sql_password = "密码"
connstr = "Provider = Sqloledb; User ID = " & sql_username & "; Password = " & sql_password & "; Initial Catalog = " & sql_databasename & "; Data Source = " & sql_localname & ";"
Set conn = Server.CreateObject("ADODB.Connection")
conn.open connstr
%>