当前位置:编程学习 > C#/ASP.NET >>

各位高手能否帮我看一下这个conn.ASP的设置哪里出问题,数据库连接不上

各位高手能否帮我看一下这个conn.ASP的设置哪里出问题,数据库连接不上

原文内容:
<%session.Timeout=180%>
<%
Dim scriptName
scriptName=Request.ServerVariables("script_name")
i = instrRev(scriptname,"/")
scriptname = ucase(right(scriptname,len(scriptname)-i))
'Response.Write scriptname
''''''''''''''''''''''''''''''''''''''''''''''''''''''以上四行语句得到本页面的文件名称,后边要进行文件名称比较

Dim Conn
Dim DBFileObject,DBFile
Dim strTmp,strServer,strDB,strUid,strPwd,arrTmp
    
strTmp = ""
strServer = ""
strDB = ""
strUid = ""
strPwd = ""
set InfoEncrypt=server.CreateObject("Infoencrypt.encrypt")
'Response.Write infoencrypt.encode("yxz")& "<br>"
'Response.Write infoencrypt.encode("scm")& "<br>"
'Response.Write infoencrypt.encode("idudba")& "<br>"
'Response.Write infoencrypt.encode("iloveidu")& "<br>"
'Response.Write infoencrypt.encode("yxz数据库")& "<br>"
'Response.End 
Set DBFileObject = Server.CreateObject("Scripting.FileSystemObject")
   
Dim strFilePath
strFilePath = Trim(Request.ServerVariables("APPL_PHYSICAL_PATH"))
strFilePath = strFilePath + "ConfigSys\DBServerInfo.dat"    
Set DBFile = DBFileObject.OpenTextFile(strFilePath)
    
Count=0
Do while not DBFile.AtEndOfStream
    strTmp = DBFile.ReadLine
    arrTmp = split(strTmp,"и",-1) 
    if InfoEncrypt.decode(trim(arrTmp(4)))=Request.Form("strAccount") then
        strServer = InfoEncrypt.decode(trim(arrTmp(0)))
        strDB =InfoEncrypt.decode(trim(arrTmp(1)))
        strUid =InfoEncrypt.decode(trim(arrTmp(2)))
        strPwd =InfoEncrypt.decode(trim(arrTmp(3)))
        session("strServer") = strServer
    session("strDB") =strDB
        session("strUid") =strUid
        session("strPwd") =strPwd
        session("strAccount")=Request.Form("strAccount")
        exit Do
    End if
    Count=Count+1
loop
DBFile.Close
'Response.Write strServer& "<br>" & strDB &"<br>"& strUid
'''''''''''''''''''''''''''''''''''''''''''''通过上页的表单值确定打开哪个帐套,并得到打开数据库连接的参数
'If IsObject(Session("SCMConn")) and Not IsNull(Session("SCMConn")) and scriptName<>"LOGIN.ASP" and session("UserID")<>"" Then
If IsObject(Session("SCMConn")) and Not IsNull(Session("SCMConn"))  and scriptName<>"LOGIN.ASP"  Then
    Set Conn = Session("SCMConn")
Else
    If strServer <> "" and strDB <> "" and strUid <> "" Then
    'On Error Resume Next
       Set Conn=Server.CreateObject ("adodb.connection")
        Conn.Open "driver={sql server};server="&58.61.157.153&";uid="&sq_xianjie84&";pwd="&ppij840314&";database="&sq_xianjie84        
        If Err.number>0    Then
            Response.Write "数据库服务器端连接错误,请您点击<a href='mailto:master@idu.com.cn'>这里</a>用邮件与易读网管理员联系。谢谢!</p>"
            Response.End
        Else
            Set Session("SCMConn") = Conn
        End If
    Else
        'Response.Write "<br><br><div align=center><h1>数据库服务器配置有错误,请重新配置!</h1></div>"
        'Response.End 
    End If
End If

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''以下为 DataAccess组件
'If IsObject(Session("SCMDataAccess")) and  Not IsNull(Session("SCMDataAccess")) and scriptName<>"LOGIN.ASP"  and session("UserID")<>""  Then
If IsObject(Session("SCMDataAccess")) and  Not IsNull(Session("SCMDataAccess")) and scriptName<>"LOGIN.ASP"   Then
    Set DataAccess = Session("SCMDataAccess")
Else
    If strServer <> "" and strDB <> "" and strUid <> "" Then
        dim DataAccess
        Set DataAccess=server.CreateObject("DataAccess.Access")
        DataAccess.Server =strServer
        DataAccess.UserName=strUid
        DataAccess.Password=strPwd
        DataAccess.DB =strDB
        DataAccess.OpenConn()
    
        If Err.number>0    Then
            Response.Write "数据库服务器端连接错误,请您点击<a href='mailto:master@idu.com.cn'>这里</a>用邮件与易读网管理员联系。谢谢!</p>"
            Response.End
        Else
            Set Session("SCMDataAccess") = DataAccess
        End If
    Else
        'Response.Write "<br><br><div align=center><h1>数据库服务器配置有错误,请重新配置!</h1></div>"
        'Response.End 
    End If
End If
'Response.Write strDB&"<br>asdf<br>"
'Response.Write strUid
'Response.End 

%>  --------------------编程问答-------------------- 顶起……
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,