[英]Classic ASP Error 80004005 when trying to connect to SQL Server
I am trying to connect a classic ASP webpage to SQL Server 2008, and whatever I do I keep getting this...我正在尝试将一个经典的 ASP 网页连接到 SQL Server 2008,无论我做什么,我都会收到这个......
error '80004005'
It then proceeds to tell me the line where the error is, and that is all.然后它继续告诉我错误所在的行,仅此而已。
My connection code is as follows我的连接代码如下
<%
Dim Stock
Dim Stock_cmd
Dim Stock_numRows
Set Stock_cmd = Server.CreateObject ("ADODB.Command")
Stock_cmd.ActiveConnection = MM_DVerto_STRING
Stock_cmd.CommandText = "SELECT Location, Part_Number FROM dbo.Stock_Header WHERE Part_Number = ?"
Stock_cmd.Prepared = true
Stock_cmd.Parameters.Append Stock_cmd.CreateParameter("param1", 200, 1, 15, Stock__MMColParam2) ' adVarChar
Set Stock = Stock_cmd.Execute
Stock_numRows = 0
%>
Connection File连接文件
<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="false"
' Catalog=""
' Schema=""
Dim MM_DVerto_STRING
MM_DVerto_STRING = "dsn=CMD SQL;uid=web;"
%>
Any help would be greatly accepted!任何帮助将被极大地接受!
Error 80004005 is:错误 80004005是:
Data source name not found and no default driver specified
未找到数据源名称且未指定默认驱动程序
Most likely your web server is missing an ODBC connection named CMD SQL
.很可能您的 Web 服务器缺少名为
CMD SQL
的 ODBC 连接。
If not, here is the full list of possible causes from that MSDN link:如果没有,这里是来自该 MSDN 链接的可能原因的完整列表:
- The Microsoft Windows NT 4.0 or Windows 2000 user account that is used to process the request for the ASP page does not have sufficient permissions to read the registry key that stores the specified DSN's configuration information.
用于处理 ASP 页请求的 Microsoft Windows NT 4.0 或 Windows 2000 用户帐户没有足够的权限来读取存储指定 DSN 的配置信息的注册表项。
- The System ODBC DSN that is specified in the ADO connection string does not exist on the IIS server.
IIS 服务器上不存在 ADO 连接字符串中指定的系统 ODBC DSN。
- The ASP Application or Session variable that is initialized in the ASP application's Global.asa file (or in an ASP page that is accessed before the page that contains the database connection code) is used to specify the ADO connection string.
在 ASP 应用程序的 Global.asa 文件(或在包含数据库连接代码的页面之前访问的 ASP 页)中初始化的 ASP 应用程序或会话变量用于指定 ADO 连接字符串。 This connection string variable is not initialized when the code to open the database connection is run.
运行打开数据库连接的代码时,未初始化此连接字符串变量。 To confirm this, add a Response.Write statement before the line of code that opens the database connection to display the connection string that is stored in the variable.
要确认这一点,请在打开数据库连接以显示存储在变量中的连接字符串的代码行之前添加 Response.Write 语句。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.