gpt4 book ai didi

database - CLASSIC asp 连接到 SQL Express Server 500 服务器错误

转载 作者:搜寻专家 更新时间:2023-10-30 20:42:32 25 4
gpt4 key购买 nike

嘿,我正在尝试在 Classic ASP

中连接到我的 SQL Server 版本 10.50.2500

我在 .asp 页面中的代码是(包括我尝试使用的所有连接字符串):

Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")

'objConn.ConnectionString = "Provider={SQL Server};Server=xxx.xxx.xxx.xxx\SQLEXPRESS;Database=JForm;User ID=xxxx;Pwd=xxxx"
'objConn.ConnectionString = "Driver={SQL Server};Server=xxx.xxx.xxx.xxx\SQLEXPRESS;Database=JForm;Uid=xxxx;Pwd=xxxx;"
'objConn.ConnectionString = "Provider=SQLNCLI10;Server=xxx.xxx.xxx.xxx,1433;Database=JForm;Uid=xxxx;Pwd=xxxx;Persist Security Info=True"
'objConn.ConnectionString = "Provider=SQLNCLI;Server=.\SQLEXPRESS;Database=JForm;Uid=xxxx;Pwd=xxxx"
objConn.ConnectionString = "Driver={SQL Server Native Client 10.0};Server=xxx.xxx.xxx.xxx\SQLEXPRESS;Database=JForm;Uid=xxxx;Pwd=xxxx"

strSQL = "UPDATE jURLS " & _
"SET rssFeedURL = 'http://www.xxxx.com/rss/" & rss & "'," & _
"csvURL = 'http://www.xxxx.com/csv/" & csv & "'," & _
"jFormName = '" & forname & "'," & _
"isActive = " & active & " " & _
"WHERE jFormName = '" & forname & "'"

objConn.open
objRS.Open strSQL, objConn, 1,3

'If Not objRS.EOF Then
'iterate through records here
'Else
'no records found
'End If

objRS.close
Set objRS=Nothing
objConn.close
Set objConn=Nothing

它似乎在 objConn.open 上崩溃。但是,它只给我一个 500 - 内部服务器错误。 而不是一个有用的错误!

一旦我从页面中取出数据库代码并保留其他所有内容,它就可以正常工作而不会显示 500 - 内部服务器错误

为了让它正常工作,我还能尝试什么?

最佳答案

这里多了一个逗号:

"isActive = " & active & "," & _

将其更改为:

"isActive = " & active & " " & _

关于连接错误,try debugging using the connection.errors collection

On Error Resume Next
objConn.open

for each errobj in objConn.Errors
Response.write errobj.Number & "<br />"
Response.write errobj.Description & "<br />"
next

On Error Goto 0

关于database - CLASSIC asp 连接到 SQL Express Server 500 服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13614255/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com