php试用smarty和ADODB实现对数据分页读取(2)
来源:未知 责任编辑:责任编辑 发表时间:2014-04-20 03:36 点击:次
$this->conn = NewADOConnection('mssql');
$this->conn->Connect($this->host, $this->user, $this->pwd, $this->dbname);
}else if($this->dbtype == 'access'){
$this->conn = NewADOConnection('access');
$this->conn->Connect("Driver={Microsoft Access Driver(*.mdb)};Dbq=".$this->dbname.";Uid=".$this->user.";Pwd=".$this->pwd.";");
}
$this->conn->Execute("set names utf-8");
if($this->dbtype == 'mysql')
$this->conn->debug = $this->debug;
return $this->conn;
}
function CloseConnId(){
$this->conn->Disconnect();
}
}
class AdminDB{
function ExecSQL($sqlstr, $conn){
$sqltype = strtolower(substr(trim($sqlstr), 0,6));//去sql语句的前6个字符
$rs = $conn->Execute($sqlstr);
if($sqltype == 'select'){
$array = $rs->GetRows();
if(count($array)==0 || $rs == false)
return false;
else
return $array;
}else if($sqltype == 'update'||$sqltype == 'insert'||$sqltype == 'delete'){
//这写都是不返回结果集的,或者说返回空集合
if($rs)
return true;
else
return false;
相关新闻>>
- 发表评论
-
- 最新评论 更多>>