• php 操作access


    <?php
    session_start();
    error_reporting(E_ALL & ~ E_NOTICE);
    
    //读取mdb数据库例程
    $dbname = "a.mdb";
    $conn = new com("adodb.connection");          //实例化adodb
    $connstr="driver={microsoft access driver (*.mdb)}; dbq=". realpath($dbname);     //连接数据库路径
    $conn->open($connstr);                 //打开数据库
    
    $rs=new com("adodb.recordset");               //实例化adodb
    $sql="select `b1` from `b`";      //查询
    $rs->open($sql,$conn,1,3);
    $a1 = $rs->fields[0]->value;
    
    $aid8 = $_GET["aid"];
    if ($aid8)
    {
        $dbnameb = "b.mdb";
        $connb = new com("adodb.connection");          //实例化adodb
        $connstrb="driver={microsoft access driver (*.mdb)}; dbq=". realpath($dbnameb);     //连接数据库路径
        $connb->open($connstrb);                 //打开数据库
    
        $rsb=new com("adodb.recordset");               //实例化adodb
        #$sqlb="update `b` set `b1`='{$a1}'"; // update
        $sqlb="insert into `b`(b1,b2) values('{$a1}', '234')";   // insert
        
        $connb->execute($sqlb);
    
        echo "已成功把A数据库的a1 字段数据导入 B数据库!";
    }
    
    ?>
    
    
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <meta name="author" content="">
    
    <title>Access数据库操作</title>
    <style type="text/css">
    <!--
    body,td,th {
        font-size: 14px;
    }
    -->
    </style>
    
    </HEAD>
    <BODY leftmargin="20" topmargin="20" marginwidth="0" marginheight="0">
    <form name="azbce8" action="?aid=azbnb" method="post">
    <table width="500" border="0" align="center" cellpadding="5" cellspacing="5" style="border:1px solid #0099CC;">
      <tr>
        <td height="25">这里是A数据库</td>
      </tr>
      <tr>
        <td>字段a1 内容:<font color="#FF0000"><?php echo $a1 ?></font></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td align="center"><input name="nb" type="submit" value="按钮A转B" /></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table>
    
    </form>
    </body>
    </html>

    http://p6.zbjimg.com/task/2012-05/17/1706749/4fb4ee1c680dc.rar
  • 相关阅读:
    单例模式(Singleton)的6种实现
    深入浅出单实例Singleton设计模式
    Singleton单例模式
    面试中的Singleton
    海量数据存储之Key-Value存储简介
    大数据时代的 9 大Key-Value存储数据库
    python 多线程两种实现方式,Python多线程下的_strptime问题,
    pycURL的内存问题
    百万级访问网站前期的技术准备
    IPv6 tutorial – Part 6: Site-local addresses and link-local addresses
  • 原文地址:https://www.cnblogs.com/94YY/p/3019323.html
Copyright © 2020-2023  润新知