环境:PHP+Apache+SQL Server2000存储过程参数:@sqlst(sql语句)、@currentpage(第N页)、@pagesize(每页行数)问题详情:
通过调用COM组件调用vb写的DLL代码执行一个分页的存储过程,但是却出现参数无法传入存储过程的情况,php代码如下:<?php
$sql = "select * from t_User where FUserID>1000 and FName like '%许云祥%' order by FUserID";
$b= new COM("esp.espc");
$list=$b->ExecSP($sql);
?>
esp是vb写的dll,具体功能是执行分页功能,vb代码如下:Option Explicit
'Private rs As New ADODB.Recordset
Private adocomm As New ADODB.Command
Public Function ExecSP(sql As String) As ADODB.Recordset
Set db = New ADODB.Connection
db.ConnectionString = CONNECT_STRING
db.CursorLocation = adUseClient
db.ConnectionTimeout = 30
db.Open
Set adocomm.ActiveConnection = db
adocomm.CommandType = adCmdStoredProc
adocomm.CommandText = "p_Common_Pagination" '取领料单 单据编号
adocomm.Parameters(1) = sql
adocomm.Parameters(2) = 1
adocomm.Parameters(3) = 20
Set ExecSP = adocomm.Execute
End Function现在由于$sql中含有汉字,导致后面两个参数无法传入到存储过程中,事件跟踪信息如下:
exec p_Common_Pagination N'select * from t_User where FUserID>1000 and FName like ''%许云祥%'' order by FUserID但是,如果用vb直接调用esp.dll是可以得到正确预期的,事件跟踪信息如下:
exec p_Common_Pagination N'select * from t_User where FUserID>1000 and FName like ''%许云祥%'' order by FUserID', 1, 20
通过调用COM组件调用vb写的DLL代码执行一个分页的存储过程,但是却出现参数无法传入存储过程的情况,php代码如下:<?php
$sql = "select * from t_User where FUserID>1000 and FName like '%许云祥%' order by FUserID";
$b= new COM("esp.espc");
$list=$b->ExecSP($sql);
?>
esp是vb写的dll,具体功能是执行分页功能,vb代码如下:Option Explicit
'Private rs As New ADODB.Recordset
Private adocomm As New ADODB.Command
Public Function ExecSP(sql As String) As ADODB.Recordset
Set db = New ADODB.Connection
db.ConnectionString = CONNECT_STRING
db.CursorLocation = adUseClient
db.ConnectionTimeout = 30
db.Open
Set adocomm.ActiveConnection = db
adocomm.CommandType = adCmdStoredProc
adocomm.CommandText = "p_Common_Pagination" '取领料单 单据编号
adocomm.Parameters(1) = sql
adocomm.Parameters(2) = 1
adocomm.Parameters(3) = 20
Set ExecSP = adocomm.Execute
End Function现在由于$sql中含有汉字,导致后面两个参数无法传入到存储过程中,事件跟踪信息如下:
exec p_Common_Pagination N'select * from t_User where FUserID>1000 and FName like ''%许云祥%'' order by FUserID但是,如果用vb直接调用esp.dll是可以得到正确预期的,事件跟踪信息如下:
exec p_Common_Pagination N'select * from t_User where FUserID>1000 and FName like ''%许云祥%'' order by FUserID', 1, 20
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货