php 调用mssql 存储过程不能执行问题

WBOY
Release: 2016-06-23 14:04:36
Original
1221 people have browsed it

存储过程不能执行还是什么情况,反正不能出现结果

require("../inc/hbmconn.php");//传入vip 姓名$name=iconv("utf-8","gb2312",$_REQUEST['name']);$startTime="2012-04-01";$endTime="2012-04-03";$procedure = mssql_init("procGetVIPConsumeDetail",$conn);mssql_bind($procedure,"@vipConsumerFilter",$name, SQLVARCHAR); mssql_bind($procedure,"@startDate",$startTime, SQLDATETIME); mssql_bind($procedure,"@endDate",$endTime, SQLDATETIME); $resource = mssql_execute($procedure);mssql_free_statement($procedure);
Copy after login


不能执行,不知啥情况,路过的帮忙看看


回复讨论(解决方案)

echo mssql_get_last_message();
看看有无错误信息

echo mssql_get_last_message();
看看有无错误信息

常量 SQLDATETIME 没有定义
请确认你书写的是否正确
你还可以 print_r(get_defined_constants());
看一下是否有类似的常量

最后那条错误信息的含义不太清楚,可能是日期格式不对吧

//传入vip 姓名$name=iconv("utf-8","gb2312",$_REQUEST['name']);//echo $name;$startTime="1970-01-01";$endTime=date("H-m-d");$procedure = mssql_init("procGetVIPConsumeDetail",$conn);mssql_bind($procedure,"@vipConsumerFilter",$name, SQLVARCHAR); mssql_bind($procedure,"@startDate",$startTime,  SQLVARCHAR); mssql_bind($procedure,"@endDate",$endTime,  SQLVARCHAR); $resource = mssql_execute($procedure);mssql_free_statement($procedure);
Copy after login



把日期也换成SQLVARCHAR 格式,莫名其妙的就好了...我那个去!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template