php调用ms sql数据库存储过程。。。
时间:2007-12-23 来源:不详 作者:迈克DB
<?php
$hostname = "tszzp";
$dbuser = "sa";
$dbpasswd = "";
$id = mssql_connect($hostname,$dbuser,$dbpasswd) or die("无法连接数据库服务器!");
//printf("%d<BR>", $id);
$db = mssql_select_db("stock",$id) or die("无法连接stock数据库!");
$stockcode='600600';
$id = 0;
$msg = 0;
//printf("%d<BR>", $db);
//$query = "exec sp_test @code='600028',@id=0,@msg='000000'";
$query = "declare @result int, @id int, @msg varchar(20)";
$query.="exec @result=sp_test";
$query.="\"$stockcode\",";
$query.="@id output,";
$query.="@msg output;";
$query.="select @result result, @id id, @msg msg"; 织梦内容管理系统
/*$query = "declare @result int, @id int, @msg varchar(20)";
$query.="exec @result=sp_test";
$query.="\"$stockcode\",";
$query.="@id output,";
$query.="@msg output;";
$query.="select @result result, @id id, @msg msg";
*///$query = "update test set stockname='2test' where stockcode='600028'";
//$query = "insert into test(stockcode,stockname,id) values ('600028','test',13)";
//$query = "select * from test where stockcode='600028'";
//$query = "select 0 where 1=0 ";
$rresult = mssql_query($query) or die("无法执行SQL:$query");
$arr = mssql_fetch_array($rresult);
print $result;
print "<br>";
printf("%d, %d, %s<br>", $arr[result], $arr[id], $arr[msg]);
printf("%d, %s<br>", $id, $msg);
织梦好,好织梦
//$stock = mssql_fetch_array($result);
//$name = $stock[id];
//print $name;
//print "abc";
?> asp">存储过程asp?tags=数据库">数据库
文章评论
共有位Admini5网友发表了评论 查看完整内容