$myServer="localhost";//主机
$myUser="sa";//用户名
$myPass="password";//密码
$myDB="Northwind";?//MSSQL库名
$s=@mssql_connect($myServer,$myUser,$myPass)
ordie("Couldn'tconnecttoSQLServeron$myServer");
$d=@mssql_select_db($myDB,$s)
ordie("Couldn'topendatabase$myDB");
$query="SELECTTitleOfCourtesy+''+FirstName+''+LastNameASEmployee";
$query.="FROMEmployees";
$query.="WHERECountry='USA'ANDLeft(HomePhone,5)='(206)'";
$result=mssql_query($query);
$numRows=mssql_num_rows($result);
echo"
".$numRows."Row".($numRows==1?"":"s")."Returned
";while($row=mssql_fetch_array($result))
{
echo"
}