coon文件中数据库连接出错,提示修改字串,如何解决?
发布网友
发布时间:2024-10-23 04:24
我来回答
共1个回答
热心网友
时间:2024-11-05 12:14
你可以把这个asp文件直接改掉.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
'Option Explicit
Response.Buffer = True
Server.ScriptTimeOut = 90
Session.CodePage=65001
'定义数据库连接
on error resume next
Dim Conn
Dim ConnStr
ConnStr="Provider=SQLOLEDB.1;Password=123;Persist Security Info=True;User ID=sa;Initial Catalog=ACCP_ASP"
Set Conn= Server.CreateObject("ADODB.Connection")
Conn.ConnectionString="Provider=SQLOLEDB.1;Password=123;Persist Security Info=True;User ID=sa;Initial Catalog=ACCP_ASP"
Conn.Open
If Err Then
err.Clear
Set Conn = Nothing
Response.Write("<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" />数据库连接出错,请检查连接字串。")
Response.End
End If
%>
<%
'查找总信息
dim rrrs
dim company_name
set rrrs=server.createobject("adodb.recordset")
rrrs.open "select * from sys where id=1000",conn,1,3
company_name=rrrs("company_name")
rrrs.close
%>
参考资料:http://xiaokai.gywgy.com/