<%@language=vbscript codepage=936 %>
<%
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
'Response.CacheControl = "no-cache"
'Response.AddHeader "Pragma", "No-Cache"
dim conn
dim connstr
dim db
Dim Qcdn
db=""
Set conn = Server.CreateObject("ADODB.Connection")
'connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
'connstr="ConnStr="provider=sqloledb;data source=这里写了远程数据IP,1433;User ID=sa;pwd=写了连接的密码;Initial Catalog=sucessnet"
'connstr="driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath(""&db&"")
conn.Open connstr
Set Qcdn=New Qcdn_newsFun
sub closeConn()
conn.close()
set conn=nothing
end sub
%>
可是还是连不上 提示是
Microsoft OLE DB Provider for ODBC Drivers 错误 '***********'
[Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序
/sosocg/admin/conn.asp,行 18
怎么写CONN.ASP文件啊?
參考答案:'connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
'connstr="ConnStr="provider=sqloledb;data source=这里写了远程数据IP,1433;User ID=sa;pwd=写了连接的密码;Initial Catalog=sucessnet"
'connstr="driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath(""&db&"")
三句前面都加 ' 干嘛``~
是MSSQL的话,前面也加 ',就没用了,中间那句问题很明显,改成如下:
connstr = "Provider=SQLOLEDB.1; Data Source=这里写了远程数据IP,1433;User ID=帐号; Password=密码; Initial Catalog=库名"