这是VbFunction.asp的代码出错行为      conn.open "driver={SQL Server};server=xfgsj-b45345248/sql;uid=fh;pwd=com;database=fh"而且它的库没有任何扩展名,用SQL附加提示不是有效的SQL库
<%
  '----------------------------------------------------
  Function RequestURL()
    dim QueryString
    RequestURL="Page=" & Request.ServerVariables("PATH_INFO")
    QueryString = Request.ServerVariables("QUERY_STRING")
    if Len(QueryString) > 0 then RequestURL = RequestURL & "&" & QueryString  
  End Function
  '----------------------------------------------------
  Function GetRs(Sql,Conn )
    Dim Rs
    set rs=nothing
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Rs.Open Sql, Conn, 1,1
    Set getrs = rs
  End Function
  '----------------------------------------------------
  Function GetRs3(Sql,Conn )
    Dim Rs
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Rs.Open Sql, Conn, 1,3
    Set getrs3 = rs
  End Function
  '----------------------------------------------------
  Function getrnd(lens,typ)   '取得随机数
  IF typ=1 then               '数字
  a=10
  b=48
  elseif typ=2 then           '字母
  a=26
  b=97
  elseif typ=3 then           '乱码
  a=8
  b=58
  else                        '默认为数字
  a=10
  b=48
  end if
  while len(getrnd)<lens+1
  randomize
  getrnd=getrnd&chr(int((a*rnd)+b))
  wend
  End Function
  
  '----------------------------------------------------
  '建立数据库链接
  Function GetConn(Param)
    Dim Conn 
    Set Getconn = Nothing
    Set conn = Server.CreateObject("ADODB.Connection")
    'Conn.Open Param
    conn.open "driver={SQL Server};server=xfgsj-b45345248/sql;uid=fh;pwd=com;database=fh"
    Set getConn = Conn
  End Function
  '----------------------------------------------------
  '过滤HTML及脚本代码
  Function NoHtml(text)
  nohtml=replace(text,"<","&lt;")
  nohtml=replace(nohtml,">","&gt;")
  nohtml=replace(nohtml,"'","&apos;")
  End Function
  '----------------------------------------------------
  Function sqlstr(TextIn)
     sqlstr = Replace(TextIn, "'" , "")
   End Function
   '----------------------------------------------------
    Function StrLen(Str)
     dim p_len, i
     p_len=0
     StrLen=0
     if Trim(Str)<>"" then
       p_len=Len(Trim(Str))
       for i=1 to p_len
         if abs(asc(mid(str,i,1)))>255 then
           StrLen=int(StrLen) + 2
         else
           StrLen=int(StrLen) + 1
         end if
       next
     end if
   End Function
   '----------------------------------------------------
  '取字符串Str的前面Length个字符
  Function GetStr(Str, Length)
    dim s_len,r_len, i
    r_len=0
    s_len=Len(Str)
    GetStr="" 
    if StrLen(Str) < Length then 
      GetStr=Str
      Exit Function
    end if   
    for i=1 to s_len
      if r_len>Length then Exit for
      r_len=r_len+StrLen(Mid(Str,i,1))
      GetStr=GetStr+Mid(Str,i,1)
    next
  End Function
'--------------------------------------------------------
  Function CheckAdmin(module)
  IF Request.Cookies("Login_"&module)<>"yes" then
  Response.Redirect "/"
  end if
  End Function
'----------------------------------------------------------
  Function T_Space(n)
  Response.Write "<table><tr><td height="&n&"></td></tr></table>"
  End Function
  %>

解决方案 »

  1.   

    SqlUsername = "sa"           'SQL数据库用户名
    SqlPassword = "123"       'SQL数据库用户密码
    SqlDatabaseName = "HTOA"    'SQL数据库名
    SqlHostIP = "192.168.0.205"           'SQL主机IP地址ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlHostIP & ";"
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.Open connstr
      

  2.   

    INF: Potential causes of the "SQL Server does not exist or access denied" error message 
    http://support.microsoft.com/kb/328306/
      

  3.   

    还是不好用呀。SQL里还用设置什么吗?
      

  4.   

    装完SQL SP4后又出现如下错误错误类型:
    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC SQL Server Driver][DBNETLIB]
    /include/VbFunction.asp, 第 52 行
      还是跟上一次出错的同一行,还有我这个数据库没有扩展名,而且我用SQL附加库的时候,提示我不是有效的sql数据库,请高手指点一下。