发布:2014/7/9 8:49:53作者:管理员 来源:本站 浏览次数:1623
释放与指定语句关联的所有资源。在调用此函数后,将无法再次使用此语句。
以下示例创建语句资源,执行单个查询,并且调用 sqlsrv_free_stmt 以释放与语句关联的所有资源。此示例假定本地计算机上已安装了 SQL Server 和 AdventureWorks 数据库。从命令行运行此示例时,所有的输出都将写入控制台。
<?php /* Connect to the local server using Windows Authentication and specify the AdventureWorks database as the database in use. */ $serverName = "(local)"; $connectionInfo = array( "Database"=>"AdventureWorks"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn === false ) { echo "Could not connect.\n"; die( print_r( sqlsrv_errors(), true)); } $stmt = sqlsrv_query( $conn, "SELECT * FROM Person.Contact"); if( $stmt ) { echo "Statement executed.\n"; } else { echo "Query could not be executed.\n"; die( print_r( sqlsrv_errors(), true)); } /*------------------------------- Process query results here. -------------------------------*/ /* Free the statement and connection resources. */ sqlsrv_free_stmt( $stmt); sqlsrv_close( $conn); ?>
© Copyright 2014 - 2024 柏港建站平台 ejk5.com. 渝ICP备16000791号-4