include('adodb5/adodb.inc.php');
$myServer = "localhost";
$myUser = "root";
$myPass = "root";
$myDB = "database";
//create an instance of the ADO connection object
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
//define connection string, specify database driver
$connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;
$conn->open($connStr); //Open the connection to the database
这是我第一次遇到 ADODB 库,据说它可以帮助我从 MySQL 切换到 Microsoft SQL Server。有谁知道我为什么会收到此错误,或者是否有更简单的方法不涉及使用 php.ini 文件?