安装好php的sqlsrv模块
//本地连接
$servername = "cx95dlisvw4c6tk\aaa";//计算机名\实例名
$connectioninfo = array("database"=>"fff","connectionpooling"=>'','uid'=>'sa','pwd'=>'123');
$conn = sqlsrv_connect( $servername, $connectioninfo);
if( $conn == false)
{
echo "连接失败!";
die( print_r( sqlsrv_errors(), true));
}else{
echo "dfdf";
$query=sqlsrv_query($conn,"select * from dbo.fdsf");
while($row = sqlsrv_fetch_array($query)){
print_r($row);
}
//print_r($query);
}
//远程连接
$servername = "192.168.1.5";
$connectioninfo = array("database"=>"cia","connectionpooling"=>'','uid'=>'sa','pwd'=>'360kad.com');
$conn = sqlsrv_connect( $servername, $connectioninfo);
if( $conn == false)
{
echo "连接失败!";
die( print_r( sqlsrv_errors(), true));
}else{
echo "dfdf";
$query=sqlsrv_query($conn,"select * from codesitetaker_model");
while($row = sqlsrv_fetch_array($query)){
print_r($row);
}
//print_r($query);
}
开发环境: 1、开发语言:asp.net 2.0(C#) 2、数据库sql 2005 3、开发平台:windows 2003+Microsoft .NET Framework v2.0 +Microsoft SQL server 2005+IIS6.0 配置环境要求: 1、操作系统须为windows 2003,须已安装IIS Web 6.0以上服务 (从Windows组件中安装IIS) 2、须已安
0
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号