欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

php 插入 access

shiping1 的头像
$txtTitle = $_POST['txttitle'];
$txtTel = $_POST['txttel'];
$txtBaoKaoKeMu = $_POST['txtbaokaokemu'];
$txtReiXunLeiXing = $_POST['txtpeixunleixing'];
$txtIsTuti = $_POST['txtistuti'];
$txtRenshu = $_POST['txtrenshu'];

$conn = @new COM("ADODB.Connection") or die ("ADO Connection faild.");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath($_SERVER['DOCUMENT_ROOT']."/Inc/xuesi.mdb");
//$connstr="Provider=Microsoaft.Jet.OLEDB.4.0;Data Source=".$_SERVER['DOCUMENT_ROOT']."/Inc/xuesi.mdb";
$conn->Open($connstr);
$sql ="insert into baomingren(txttitle)
       values('111111111')";
//下面一行可以插入  好像用它更好
//$conn->execute($sql);
//下面两行也可以插入 好像用它不太好
$rs = @new COM("ADODB.RecordSet");
$rs->Open($sql,$conn,1,3);

$rs->close();
$conn->Close();
echo $sql;
普通分类: