我对ADO和PHP使用基本的SQL查询,但行数总是返回-1。我错过了什么?
这里是我的代码:
include 'constants.php';
// Create an instance of the ADO connection object
$conn = new COM ("ADODB.Connection")
or die("Cannot start ADO");
// Open the connection to the database
$conn->open(DB_CONN_STR);
$query = "select * from table_name";
$rs = $conn->execute($query);
if (!$rs) {
return;
}
else {
return $rs->RecordCount();
}
我知道这表有值...我缺少什么?
哪里是执行函数的代码和RecordCount()的代码;这是唯一可能出错的地方。 –