在控制面板---ODBC---设置DSN,用DSN访问数据库
  set dc=server.createobject("ADODB.Connection")
  dc.open("dsn=xxx;uid=sa;pwd=vv")
  strSQL="select * from table"
  set sc=dc.execute(strSQL)

解决方案 »

  1.   


      改成混合验证模式
      
      在企业管理器》服务器》属性》安全性》身份验证》改成:SQLSERVER 和 WINDOWS...改后重启服务
      

  2.   

    dim conn   
    dim connstr   
    'on error resume next set conn=server.createobject("adodb.connection")
    connstr="provider=sqloledb;user id=sa;password=密码;initial catalog=xinwen;data source=zhaowei"
    conn.open connstr
    if err.number<>0 then 
    err.clear
    set conn=nothing
    response.write "数据库连接出错!"
    Response.End
    else
    conn.open connstr
    if err then 
    err.clear
    set conn=nothing
    response.write "数据库连接出错!"
    Response.End 
    end if
    end if   

    sub endNonnection()
    conn.close
    set conn=nothing
    end sub

    current_version="v1.0 published on 2001.3.21" %>