深度思考决定人生:我在做电子商务网站(ASP+SQL)连接数据库时遇到问题 请各位高手指教

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/23 20:04:00
其中global.asa文件如下
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
sub Application_OnStart
'==Visual InterDev Generated - startspan==
'--Project Data Connection
'Application("ConnectString") = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=eshop;Data Source=SLIGHT\LOCAL;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=SLIGHT;Use Encryption for Data=False;Tag with column collation when possible=False;User Id=sa;PASSWORD=sa;"
Application("Connection1_ConnectionTimeout") = 15
Application("Connection1_CommandTimeout") = 30
Application("Connection1_CursorLocation") = 3
Application("Connection1_RuntimeUserName") = "sa"
Application("Connection1_RuntimePassword") = ""
'-- Project Data Environment
'Set DE = Server.CreateObject("DERuntime.DERuntime")
'Application("DE") = DE.Load(Server.MapPath("Global.ASA"), "_private/DataEnvironment/DataEnvironment.asa")
'==Visual InterDev Generated - endspan==
'数据库连接字符串:
Application("ConnectString") = "DRIVER={SQL SERVER};SERVER=SLIGHT;Initial Catalog=eshop;UIS=sa;PWD=sa;"
Application("ConnectString") ="PROVIDER=SQLOLEDB;DATA SOURCE=(local);UID=sa;PWD=password;DATABASE=eshop"
end sub
</SCRIPT>

conn.asp文件如下:
%
dim conn
dim connstr

'on error resume next
'connstr="DBQ="+server.mappath("data/tw9c45_data.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
if err then
err.clear
else
conn.open Application("ConnectString")
if err then
err.clear
end if
end if
%>

错误提示如下:
microsoft ole db provider for SQL Server(0x80004005)
用户”sa"登陆失败。原因“未与信任SQL Server连接想关联。
/eshop/conn.asp,第12行。
sa是系统标准账号,密码也是,数据库名称是eshop

=(local);UID=sa;PWD=password;DATABASE=eshop"

应该是这句.把SA改成你的数据库账号.passwdord改成你的数据库密码.

esop改成你的数据库名字.