Feb
4
mssql存储过程:
Create PROCEDURE p_getWeiTuoDanWei
@GongChengXMID int
as
select w.weituodwid,w.danweimc
from zijinzhanghu z,gongchengxiangmu g,weituodanwei w
where z.gongchengxmid=g.gongchengxmid and w.weituodwid=z.weituodwid
and g.gongchengxmid=@GongChengXMID
order by 1
mssql.php代码:
<?php
/***********************
* 文件名:Mssql.php
* 作者:乐言(QQ:7928478)
* 主页:www.leyan.net
* 时间:2006-4-11
* 功能:PHP调用MSSQL存储过程
************************/
$dbhost="LEYAN";
$dbuser="sa";
$dbpasswd="sa";
$GongChengXMID="99";
$dbname="abc1";
$conn = @mssql_connect($dbhost,$dbuser,$dbpasswd) or die("无法连接数据库服务器!");
mssql_select_db($dbname,$conn) or die("无法连接数据库!");
$stmt = mssql_init("p_getWeiTuoDanWei",$conn) or die("视图不存在!");
mssql_bind($stmt, "@GongChengXMID", $GongChengXMID, SQLINT4);
$rs = mssql_execute($stmt, false);
do {
while ($row = mssql_fetch_array($rs)) {
echo $row["weituodwid"];
echo $row["danweimc"];
}
} while (mssql_next_result($rs));
?>
Create PROCEDURE p_getWeiTuoDanWei
@GongChengXMID int
as
select w.weituodwid,w.danweimc
from zijinzhanghu z,gongchengxiangmu g,weituodanwei w
where z.gongchengxmid=g.gongchengxmid and w.weituodwid=z.weituodwid
and g.gongchengxmid=@GongChengXMID
order by 1
mssql.php代码:
<?php
/***********************
* 文件名:Mssql.php
* 作者:乐言(QQ:7928478)
* 主页:www.leyan.net
* 时间:2006-4-11
* 功能:PHP调用MSSQL存储过程
************************/
$dbhost="LEYAN";
$dbuser="sa";
$dbpasswd="sa";
$GongChengXMID="99";
$dbname="abc1";
$conn = @mssql_connect($dbhost,$dbuser,$dbpasswd) or die("无法连接数据库服务器!");
mssql_select_db($dbname,$conn) or die("无法连接数据库!");
$stmt = mssql_init("p_getWeiTuoDanWei",$conn) or die("视图不存在!");
mssql_bind($stmt, "@GongChengXMID", $GongChengXMID, SQLINT4);
$rs = mssql_execute($stmt, false);
do {
while ($row = mssql_fetch_array($rs)) {
echo $row["weituodwid"];
echo $row["danweimc"];
}
} while (mssql_next_result($rs));
?>