0

SQLServer我的计算机上有一个使用 Microsoft 数据库文件的 VB 应用程序。我想使用PHP. 我已经在我的计算机上安装了 Apache 和 PHP。

问题是我不知道如何将我PHP的 VB 应用程序连接到数据库。

4

1 回答 1

1

首先,看看这个关于PHP 的 MS SQL (Microsoft SQL) library 的链接。

您需要使用 MS SQL 函数连接到数据库并检索您需要的相关信息。

我不是 MS SQL 专家,但您需要类似于以下的代码:

$server = "EDDYSPC\SQLEXPRESS"; // Server address
$user = "root";
$pass = "";
$db = "MyDatabase";

$msSQL = mssql_connect($serverm $user, $root);

if (!$msSQL) { // If there was an error connecting to the database
    die("An error occurred.");
}

mssql_select_db($db); // Select the datbase to use

$query = mssql_query("SELECT name FROM users WHERE name = 'Eddy'");

while ($row = mssql_fetch_assoc($query)) { // Loop through each returned row
    print($row['name'] . "<br />\n");
}

希望这会有所帮助。

于 2013-02-04T15:16:57.033 回答