本帖最后由 kushirong002 于 2012-06-21 14:44:43 编辑

解决方案 »

  1.   

    sqlncli.msi 这个我也装过了。
      

  2.   

    我的用的nts的  用的iis7.0   也连不上数据库
      

  3.   

    你的phpinfo();信息截个图发出来看看
      

  4.   

    NTS 是非线程安全的、据我了解下载的php版本也要非线程安全的。
      

  5.   

    是啊 全部都用的非线程安全的  用的iis7.0服务器  也连接不上
      

  6.   

    php_sqlser_54_ts.dll这是线程安全的
      

  7.   

    这个是我的phpinfo大家打开连接看看
    www.goxzjj.com/phpTest/phpinfo.htm
      

  8.   

    链接失败!Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -49 [code] => -49 [2] => This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712 [message] => This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712 ) [1] => Array ( [0] => IM002 [SQLSTATE] => IM002 [1] => 0 [code] => 0 [2] => [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序 [message] => [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序 ) ) 
      

  9.   

    看来是没配置好环境,不是连接错误,为啥说驱动有问题,看看设置里能调不更可能是没有
    http://go.microsoft.com/fwlink/?LinkId=163712
    找你对应的版本
      

  10.   

    我也弄好了、、换成了PHP5.3版本的
      

  11.   

    $conn=new com("Adodb.Connection");   
    $connstr="Driver={Sql Server};Server=127.0.0.1;uid=sa;pwd=;database=dataname";
    $conn->Open($connstr);
    我通过这样连接数据库成功了  但是sqlsrv_query 时出了问题
      

  12.   

    <?php
    $conn=new COM("ADODB.Connection");$connstr="Driver={Sql Server};Server=.;uid=sa;pwd=;database=EducationDB";$conn->open($connstr);$sql="select * from Navigation";$rs=$conn->Execute($sql);$row="0";while(!$rs->EOF){
    $string ="";
    for ($i=0;$i<$rs->Fields->count;$i++){    if ($i==0)    {$string.=$rs->Fields($i)->Value;continue;    }    $string.='|'.$rs->Fields($i)->Value;}$string.="\n";if ($row==300){    break;}$row++;   echo "<br>";
       echo $string;
       $rs->MoveNext();}?>