(ADO)--执行存储过程的错误
后台是SQL Server数据库,存储过程为GetMainTable
在执行存储过程时出现错误,
存储过程的参数和数据库中的顺序等完全一致,他去提示没提供参数。
代码如下:
<%
dim AssociatorID
dim RegionCode
dim TradeSortCode
dim HQCode
dim AssociatorLocalNO
dim EnterpriseCode
dim AssociatorName
dim Principal
dim Address
dim Postalcode
dim Telphone
dim NetworkSortCode
dim ApplyTime
dim ServiceSortCode
dim ServiceCharacterCode
dim CertifierCode
dim ret
AssociatorID=request.cookies("AssociatorID")
set cmdGetMain=server.createobject("ADODB.Command")
cmdGetMain.activeconnection=strconn
cmdGetMain.commandtype=adcmdstoredproc
cmdGetmain.commandtext="dbo.GetMainTable"
with cmdGetMains
.parameters.append .createparameter("RETURN_VALUE",adinteger,adparamreturnvalue)
if err then
response.write "error here"
else
response.write "i am right"
end if
.parameters.append .createparameter("@AssociatorID",adinteger,adparaminput,5,AssociatorID)
.parameters.append .createparameter("@RegionCode",adtinyint,adparamoutput)
.parameters.append .createparameter("@TradeSortCode",adtinyint,adparamoutput)
.parameters.append .createparameter("@HQCode",adsmallint,adparamoutput)
.parameters.append .createparameter("@AssociatorLocalNO",adsmallint,adparamoutput)
.parameters.append .createparameter("@EnterpriseCode",adchar,adparamoutput)
.parameters.append .createparameter("@AssociatorName",adchar,adparamoutput)
.parameters.append .createparameter("@Principal",adchar,adparamoutput)
.parameters.append .createparameter("@Address",adchar,adparamoutput)
.parameters.append .createparameter("@Postalcode",adchar,adparamoutput)
.parameters.append .createparameter("@Telphone",adchar,adparamoutput)
.parameters.append .createparameter("@NetworkSortCode",adtinyint,adparamoutput)
.parameters.append .createparameter("@ApplyTime",adTimeStamp,adparamoutput)
.parameters.append .createparameter("@ServiceSortCode",adtinyint,adparamoutput)
.parameters.append .createparameter("@ServiceCharacterCode",adtinyint,adparamoutput)
.parameters.append .createparameter("@CertifierCode",adtinyint,adparamoutput)
.execute ,,adExectueNoRecodes
'在这里出错,
'---------------------------------------------------*/
'Warning The Following Error Has Occurred:
'过程 'GetMainTable' 需要参数 '@Postalcode',但未提供该参数。
'-2147217904
'Microsoft OLE DB Provider for SQL Server
'---------------------------------------------------*/
ret= .parameters("RETURN_VALUE")
if ret=1 then
RegionCode=.parameters("@RegionCode")
TradeSortCode=.parameters("@TradeSortCode")
HQCode=.parameters("@HQCode")
AssociatorLocalNO=.parameters("@AssociatorLocalNO")
EnterpriseCode=.parameters("@EnterpriseCode")
AssociatorName=.parameters("@AssociatorName")
Principal=.parameters("@Principal")
Address=.parameters("@Address")
Postalcode=.parameters("@Postalcode")
Telphone=.parameters("@Telphone")
NetworkSortCode=.parameters("@NetworkSortCode")
ApplyTime=.parameters("@ApplyTime")
ServiceSortCode=.parameters("@ServiceSortCode")
ServiceCharacterCode=.parameters("@ServiceCharacterCode")
CertifierCode=.parameters("@CertifierCode")
response.write telphone
--------------------------------------------------------------------------
创建存储过程的SQL代码如下
CREATE PROCEDURE dbo.GetMainTable
@AssociatorID int,
@RegionCode tinyint output ,
@TradeSortCode tinyint output,
@HQCode smallint output,
@AssociatorLocalNO smallint output ,
@EnterpriseCode char (10) output ,
@AssociatorName char (40) output ,
@Principal char (12) output ,
@Address char (50) output ,
@Postalcode char (6) output ,
@Telphone char (40) output ,
@NetworkSortCode tinyint output ,
@ApplyTime datetime output ,
@ServiceSortCode tinyint output ,
@ServiceCharacterCode tinyint output ,
@CertifierCode tinyint output
AS
declare @ret int;
exec @ret=VerifyPopedom @AssociatorID;//这里参数正确
if @ret=0 return 0;
select
@RegionCode=RegionCode ,
@TradeSortCode =TradeSortCode,
@HQCode =HQCode,
@AssociatorLocalNO=AssociatorLocalNO,
@EnterpriseCode=EnterpriseCode,
@AssociatorName= AssociatorName,
@Principal=Principal,
@Address=Address,
@Postalcode=Postalcode,
@Telphone =Telphone,
@NetworkSortCode =NetworkSortCode,
@ApplyTime =ApplyTime,
@ServiceSortCode =ServiceSortCode,
@ServiceCharacterCode =ServiceCharacterCode,
@CertifierCode =CertifierCode
from MainInformation
where AssociatorID=@AssociatorID;
return 1;
GO
在执行存储过程时出现错误,
存储过程的参数和数据库中的顺序等完全一致,他去提示没提供参数。
代码如下:
<%
dim AssociatorID
dim RegionCode
dim TradeSortCode
dim HQCode
dim AssociatorLocalNO
dim EnterpriseCode
dim AssociatorName
dim Principal
dim Address
dim Postalcode
dim Telphone
dim NetworkSortCode
dim ApplyTime
dim ServiceSortCode
dim ServiceCharacterCode
dim CertifierCode
dim ret
AssociatorID=request.cookies("AssociatorID")
set cmdGetMain=server.createobject("ADODB.Command")
cmdGetMain.activeconnection=strconn
cmdGetMain.commandtype=adcmdstoredproc
cmdGetmain.commandtext="dbo.GetMainTable"
with cmdGetMains
.parameters.append .createparameter("RETURN_VALUE",adinteger,adparamreturnvalue)
if err then
response.write "error here"
else
response.write "i am right"
end if
.parameters.append .createparameter("@AssociatorID",adinteger,adparaminput,5,AssociatorID)
.parameters.append .createparameter("@RegionCode",adtinyint,adparamoutput)
.parameters.append .createparameter("@TradeSortCode",adtinyint,adparamoutput)
.parameters.append .createparameter("@HQCode",adsmallint,adparamoutput)
.parameters.append .createparameter("@AssociatorLocalNO",adsmallint,adparamoutput)
.parameters.append .createparameter("@EnterpriseCode",adchar,adparamoutput)
.parameters.append .createparameter("@AssociatorName",adchar,adparamoutput)
.parameters.append .createparameter("@Principal",adchar,adparamoutput)
.parameters.append .createparameter("@Address",adchar,adparamoutput)
.parameters.append .createparameter("@Postalcode",adchar,adparamoutput)
.parameters.append .createparameter("@Telphone",adchar,adparamoutput)
.parameters.append .createparameter("@NetworkSortCode",adtinyint,adparamoutput)
.parameters.append .createparameter("@ApplyTime",adTimeStamp,adparamoutput)
.parameters.append .createparameter("@ServiceSortCode",adtinyint,adparamoutput)
.parameters.append .createparameter("@ServiceCharacterCode",adtinyint,adparamoutput)
.parameters.append .createparameter("@CertifierCode",adtinyint,adparamoutput)
.execute ,,adExectueNoRecodes
'在这里出错,
'---------------------------------------------------*/
'Warning The Following Error Has Occurred:
'过程 'GetMainTable' 需要参数 '@Postalcode',但未提供该参数。
'-2147217904
'Microsoft OLE DB Provider for SQL Server
'---------------------------------------------------*/
ret= .parameters("RETURN_VALUE")
if ret=1 then
RegionCode=.parameters("@RegionCode")
TradeSortCode=.parameters("@TradeSortCode")
HQCode=.parameters("@HQCode")
AssociatorLocalNO=.parameters("@AssociatorLocalNO")
EnterpriseCode=.parameters("@EnterpriseCode")
AssociatorName=.parameters("@AssociatorName")
Principal=.parameters("@Principal")
Address=.parameters("@Address")
Postalcode=.parameters("@Postalcode")
Telphone=.parameters("@Telphone")
NetworkSortCode=.parameters("@NetworkSortCode")
ApplyTime=.parameters("@ApplyTime")
ServiceSortCode=.parameters("@ServiceSortCode")
ServiceCharacterCode=.parameters("@ServiceCharacterCode")
CertifierCode=.parameters("@CertifierCode")
response.write telphone
--------------------------------------------------------------------------
创建存储过程的SQL代码如下
CREATE PROCEDURE dbo.GetMainTable
@AssociatorID int,
@RegionCode tinyint output ,
@TradeSortCode tinyint output,
@HQCode smallint output,
@AssociatorLocalNO smallint output ,
@EnterpriseCode char (10) output ,
@AssociatorName char (40) output ,
@Principal char (12) output ,
@Address char (50) output ,
@Postalcode char (6) output ,
@Telphone char (40) output ,
@NetworkSortCode tinyint output ,
@ApplyTime datetime output ,
@ServiceSortCode tinyint output ,
@ServiceCharacterCode tinyint output ,
@CertifierCode tinyint output
AS
declare @ret int;
exec @ret=VerifyPopedom @AssociatorID;//这里参数正确
if @ret=0 return 0;
select
@RegionCode=RegionCode ,
@TradeSortCode =TradeSortCode,
@HQCode =HQCode,
@AssociatorLocalNO=AssociatorLocalNO,
@EnterpriseCode=EnterpriseCode,
@AssociatorName= AssociatorName,
@Principal=Principal,
@Address=Address,
@Postalcode=Postalcode,
@Telphone =Telphone,
@NetworkSortCode =NetworkSortCode,
@ApplyTime =ApplyTime,
@ServiceSortCode =ServiceSortCode,
@ServiceCharacterCode =ServiceCharacterCode,
@CertifierCode =CertifierCode
from MainInformation
where AssociatorID=@AssociatorID;
return 1;
GO
...全文
相关推荐
BestHTTP Pro Edition 1.10.2
Best HTTP Pro Edition 1.10.2 最新版, 支持Unity2017, 完美支持ipv6,仅支持测试,学习使用,切勿用于商用,如果出现什么问题,概不负责。
BestHTTP+Pro+Edition+1.10.2
Best+HTTP+Pro+Edition+1.10.2 比较好的插件。
Best HTTP2 2.1.0.unitypackage
Unity 强大的Http插件(UnityPackage): BestHttp(Pro Edition) 1.10.2
Best+HTTP+Pro+Edition+1.10.2 UnityPackage
Unity 强大的Http插件(UnityPackage): BestHttp(Pro Edition) 1.10.2
BestHttp Pro
BestHttp Pro Unity3D网络编程插件,非常实用的强大插件,仅支持测试,学习使用,切勿用于商用,如果出现什么问题,概不负责。


