2

我正在使用此代码登录到 sql server express 2012

   <?php 
      $serverName = "SD-20120627VVKE\SQLEXPRESS";

    $connectionOptions = array("Database"=>"android_api");

    $conn = sqlsrv_connect( $serverName, $connectionOptions);

    if( $conn === false )

          { die( FormatErrors( sqlsrv_errors() ) ); }
    ?> 

但我得到了这个屏幕

在此处输入图像描述

我该如何解决?

4

1 回答 1

1

试试这个:

<?php
$server = "SD-20120627VVKE\\SQLEXPRESS";
$options = array(  "UID" => "<username>",  "PWD" => "<password>",  "Database" => "android_api");
$conn = sqlsrv_connect($server, $options);
if ($conn === false) die("<pre>".print_r(sqlsrv_errors(), true));
echo "Successfully connected!";
sqlsrv_close($conn);
?>
于 2012-10-14T08:18:20.033 回答