设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 58|回复: 1
打印 上一主题 下一主题

请高手解决这个连接不上SQL SERVER 2000的问题,困惑我很长时间了

[复制链接]
跳转到指定楼层
1#
发表于 2010-1-10 07:20:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
三个文件:
1.oa.reg 确信以下帐户和密码正确
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Kingcome\KCOA]
"DBServerName"="(local)"
"DatabaseName"="LKOA"
"UserName"="sa"
"PassWord"="111111"
"TempPath"="D:\\_tohaiyan\\kcoa\\AtthTemp"
"INSTALLPATH"="D:\\_tohaiyan\\kcoa"
"Version"="V2.1"
"DBPath"="D:\\_tohaiyan\\kcoa\\DB"
"LKOADIR"="D:\\_tohaiyan\\kcoa"

2.global.asa
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=unicode" http-equiv=Content-Type>
<SCRIPT LANGUAGE=VBScript RUNAT="Server">
Sub Application_Onstart
    dim sServer,sUser,sDBName,sPass,sTmpPath,sInstallPath,sVersion
    Dim WshShell
    set WshShell=Server.CreateObject("WScript.Shell")
    sserver=WshShell.RegRead("HKLM\SOFTWARE\Kingcome\KCOA\DBServerName")
    sDBName=WshShell.RegRead("HKLM\SOFTWARE\Kingcome\KCOA\DatabaseName")
    sUser=WshShell.RegRead("HKLM\SOFTWARE\Kingcome\KCOA\UserName")
    sPass=WshShell.RegRead("HKLM\SOFTWARE\Kingcome\KCOA\PassWord")
    sTmpPath=WshShell.RegRead("HKLM\SOFTWARE\Kingcome\KCOA\TempPath")
    sInstallPath=WshShell.RegRead("HKLM\SOFTWARE\Kingcome\KCOA\INSTALLPATH")
    sVersion=WshShell.RegRead("HKLM\SOFTWARE\Kingcome\KCOA\Version")
    if right(sInstallPath,1)="\" then sInstallPath = mid(sInstallPath,1,len(sInstallPath)-1)
    set WshShell = nothing
    if sserver&"" = "" then    sserver="127.0.0.1"
    Application("ConnectString") = _
                "Provider=SQLOLEDB.1;" _
                & "Password=" & sPass & ";" _
                & "Persist Security Info=True;" _
                & "User ID=" & sUser & ";" _
                & "Initial Catalog=" & sDBName & ";" _
                & "Data Source=" & sServer & ";" _
                & "Connect Timeout=15"
    Application("RecPerPage")    =    15
    Application.Lock
    Application("whoson")=0
    Application.UnLock
    Application("Pub_Gs_ShowStr")    = "公司"
    Application("Pub_Bm_ShowStr")    = "部门"
    Application("Pub_Yg_ShowStr")    = "员工"
    Application("TempPath")    = sTmpPath
    Application("LKOAPath")    = sInstallPath
    Application("LKOAVersion") = sVersion
End sub

Sub Session_Onstart
    Session("uID")=""
    Session("uDeptID")=""
    Session("uName")=""
    Session("uNC")=""
    Session("uDeptName")=""
    Session("uYGBH")=""
    Session("uKL")=""
    Session("bbs_userName")=""
    Session("bbs_userID")=""
    Session("bbs_Dl") = ""
    'session.Timeout=20
End sub

sub session_onend
application.Lock
application("whoson")=application("whoson")-1
if application("whoson")< 1 then
    application("whoson") = 0
end if
application.UnLock
end sub
</SCRIPT>
3.connect.asp  为什么无法连接数据库
<% Response.Buffer = True %>
<%
Dim Conn
    on error resume next
    Set Conn=server.CreateObject("ADODB.CONNECTION")   
     conn.open Application("ConnectString")
    if Err<>0 then
    %>
        <script language="vbscript">
            msgbox "无法连接数据库!",vbCritical,"错误"
        </script>
    <%   
        Response.End
    end if
%>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-19 06:24 , Processed in 0.100352 second(s), 8 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表