Sql server ASP MS-SQL server 2008连接字符串
您好,我正在尝试从asp连接到MS-SQLSERVER-2008。当我运行asp页面时。我得到了这个错误 错误:Sql server ASP MS-SQL server 2008连接字符串,sql-server,sql-server-2008,asp-classic,Sql Server,Sql Server 2008,Asp Classic,您好,我正在尝试从asp连接到MS-SQLSERVER-2008。当我运行asp页面时。我得到了这个错误 错误: An error occurred on the server when processing the URL. Please contact the system administrator. 这个错误的原因是什么。 我的代码中有什么错误导致了这个错误吗 代码: 如何解决此问题?您使用的是SQL Server的express版本吗?如果需要,您需要在服务器名称后面加上“\SQL
An error occurred on the server when processing the URL. Please contact the system administrator.
这个错误的原因是什么。
我的代码中有什么错误导致了这个错误吗
代码:
如何解决此问题?您使用的是SQL Server的express版本吗?如果需要,您需要在服务器名称后面加上“\SQLEXPRESS”-例如“server=127.0.0.1\SQLEXPRESS;Database=…” 您使用的是ODBC连接字符串,这应该可以工作,但是对于SQLServer2008,您最好查看本机客户端10甚至OLEDB-请参阅下面的链接
哪行出错?@AshReva请检查帖子,我已经更新了。您的连接字符串中的“PWD=sa”、“sa”、“sa”是什么?这是您的密码吗?请尝试Connection.open“Driver={SQL Server};Server=127.0.0.1;Database=products;UID=sa;PWD=sa”从连接字符串中删除最后两个“sa”
,然后重试。在答案中添加一些文本,解释此答案如何解决当前问题,并对其他答案有帮助
<html>
<head>
</head>
<body>
<%
Dim Connection
Dim Recordset
Dim SQL
Set Connection = Server.CreateObject("ADODB.Connection")
Set Recordset = Server.CreateObject("ADODB.Recordset")
Connection.open "Driver={SQL Server};Server=127.0.0.1;Database=products;UID=sa;PWD=sa","sa","sa"
SQL = "SELECT * FROM dbo.products_images"
Recordset.Open SQL,Connection;
If Recordset.EOF Then
Response.Write("No records returned.")
Else
Do While NOT Recordset.Eof
Response.write Recordset("ID")
Response.write Recordset("product_id")
Response.write Recordset("im_name")
Response.write Recordset("im_type")
Response.write "<br>"
Recordset.MoveNext
Loop
End If
Recordset.Close
Set Recordset=nothing
Connection.Close
Set Connection=nothing
%>
</body>
</html>
Connection.open "Driver={SQL Server};Server=127.0.0.1;Database=products;UID=sa;PWD=sa","sa","sa"
<html>
<head>
</head>
<body>
<%
Dim Connection
Dim Recordset
Dim SQL
Set Connection = Server.CreateObject("ADODB.Connection")
Set Recordset = Server.CreateObject("ADODB.Recordset")
Connection.open "Driver={SQL Server};Server=127.0.0.1;Database=products;UID=sa;PWD=sa"
SQL = "SELECT * FROM dbo.products_images"
Recordset.Open SQL,Connection
If Recordset.EOF Then
If Recordset.EOF Then
Response.Write("No records returned.")
Else
Do While NOT Recordset.Eof
Response.write Recordset("Dept_Id")
Response.write Recordset("Dept_Name")
Response.write "<br>"
Recordset.MoveNext
Loop
End If
Recordset.Close
Set Recordset=nothing
Connection.Close
Set Connection=nothing
%>
</body>
</html>