• 四种常用的access连接方式


    整理出四种常用的access连接方式,当然,第1种这是最常用的(推荐使用)。
    1. 
    set dbconnection=Server.CreateOBJECT("ADODB.CONNECTION") 
    DBPath = Server.MapPath("customer.mdb") //customer.mdb是您的数据库名,您可以在前面加上路径
    dbconnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath 
    SQL="select * from auth where id='" & user_id &"'" 
    SET uplist=dbconnection.EXECUTE(SQL) 
    2. 
    set dbconnection=Server.CreateObject("ADODB.Connection") 
    DBPath = Server.MapPath("customer.mdb") 
    dbconnection.Open "provider=microsoft.jet.oledb.4.0;data source="&dbpath 
    SQL="select * from auth where id='" & user_id &"'" 
    SET uplist=dbconnection.EXECUTE(SQL) 
    3. 
    DBPath = Server.MapPath("customer.mdb") 
    set session("rs")=Server.CreateObject("ADODB.Recordset") 
    ' rs=Server.CreateObject("ADODB.Recordset") 
    connstr="provider=microsoft.jet.oledb.4.0;data source="&dbpath 
    SQL="select * from auth where id='" & user_id &"'" 
    session("rs").Open sql,connstr,1,3 2881064151 
    4. 
    建odbc源xxx (该项仅适用于独立主机用户,虚拟主机不支持数据源)
    set conn=server.createobject("Adodb.connection") 
    conn.open "DSN=xxx;UID=;PWD=;Database=customer

    SQL数据库 
    conn="Driver={SQL Server};Server=数据库服务器名称或者数据库IP地址;Database=数据库名;UID=登录用户名;PWD=登录密码" 
    Access数据库 
    conn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&server.mappath("数据库名.mdb")

  • 相关阅读:
    xx系统需求分析第七稿--权限管理(一)
    第四周学习进度总结
    hbase的Shell命令操作
    软件需求最佳实践读书笔记一
    hbase的Java基本操作
    Java 面向对象编程之接口
    Java 面向对象编程之继承的super关键词
    Java核心基础之数据类型
    Java 导出Excel
    JavaSE基础知识之修饰符和使用场景,你真的了解嘛
  • 原文地址:https://www.cnblogs.com/cbryge/p/6946540.html
Copyright © 2020-2023  润新知