日期:2014-05-17  浏览次数:20959 次

超级难解决!
<%
MM_conn_STRING   =   "Driver={SQL   Server};server=(local);uid=sa;pwd=sa;database=zhaojun; "
Set   conn   =   Server.Createobject( "ADODB.Connection ")
conn.open   MM_conn_STRING
SET   RS=SERVER.CreateObject( "ADOBD.recordset ")
SQL= "SELECT   *   FROM   student   "
RS.open   SQL,CONN,3,3
%>
不知道是什么原因就是连接不上数据库呀?
求大家给看看呀


------解决方案--------------------
<%
Dim SqlDatabaseName,SqlPassword,SqlUsername,SqlLocalName,ConnStr,Conn
SqlDatabaseName = " " 'SQL数据库名
SqlPassword = " " 'SQL数据库用户密码
SqlUsername = "sa " 'SQL数据库用户名
SqlLocalName = "(local) " 'SQL主机IP地址(本地可用“127.0.0.1”或“(local)”,非本机请用真实IP)
ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & "; "
Set conn = Server.CreateObject( "ADODB.Connection ")
conn.open ConnStr

sub CloseConn()
conn.close
set conn=nothing
end sub
%>
用这个 试 下 要是不行 应该就是你的IIS的问题了