asp调用存储过程出错

kofwr 2004-10-27 07:20:02
有一段asp
objCmd.CommandText="prQuestionAutoAnswer"

objCmd.CommandType=adCmdStoredProc '4 adCmdStoredProc
'Response.Write "s=" & Session("CourseID") & "titl=" & ProblemTitle & "proc=" & ProblemContent
objCmd.Parameters.Append objCmd.createParameter("intCourseID",3,1,,Session("CourseID"))
objCmd.Parameters.Append objCmd.createParameter("chvItemTitle",200,1,50,ProblemTitle)
objCmd.Parameters.Append objCmd.createParameter("chvItemContent",200,1,8000,server.HTMLEncode(ProblemContent))
set objRS=objCmd.Execute
调用一个存储过程


/****** Object: Stored Procedure dbo.prQuestionAutoAnswer Script Date: 2004-5-10 10:14:36 ******/

CREATE PROCEDURE prQuestionAutoAnswer
@intCourseID int,
@chvItemTitle varchar(50),
@chvItemContent varchar(8000)
AS

set nocount on

declare @chrLogContent varchar(500) --??????

--select @chrLogContent = '??????----prQuestionAutoAnswer'
--execute prAnswerInsertLog 1,"prQuestionAutoAnswer",@chrLogContent

--select @chrLogContent = SPACE(4)+'?????----#FindProblemResourceInfo'
--execute prAnswerInsertLog 3,"prQuestionAutoAnswer",@chrLogContent

declare @ErrorCode int

CREATE TABLE #FindProblemResourceInfo (
QuestionID bigint NOT NULL ,
UserID bigint NULL ,
UserName nvarchar(50) NULL,
UserRole nvarchar(50) NULL,
QuestionTitle nvarchar(255) NULL ,
ReadTimes int NULL,
Answertimes int NULL,
SubmitDate DateTime,
thePower smallint NOT NULL default 0
)
--declare @intTemp int
--declare @intProblemResourceID int
--declare @curTemp CURSOR
declare @intProblemStringLength int --???????
declare @intEndPosition int --?????????
declare @intSearchLength int --??????????
declare @chrTempString varchar(8000) --???????
declare @bitSearched bit --???????,??????????

declare @intAllPower int --?????????

declare @intHaveFullTextIndex int
select @intHaveFullTextIndex=1

declare @chvSqlString varchar(1000)

declare @intReturncode as integer

select @intAllPower=0

select @intProblemStringLength=len(rtrim(@chvItemTitle))
select @intEndPosition=@intProblemStringLength
select @intSearchLength=@intEndPosition

declare @theChar as varchar(2)

--??????????

--select @chrLogContent = SPACE(4)+'????????'
--execute prAnswerInsertLog 3,"prQuestionAutoAnswer",@chrLogContent

while @intEndPosition>0
begin
select @chrTempString=substring(@chvItemTitle,1,@intEndPosition)
select @theChar=substring(@chrTempString,@intEndPosition,1)
execute @intReturnCode=prIsChinese @thechar --?????????,??0??,1??,2??,3??,4????
if @intReturnCode=1
execute @intReturnCode=prGetWordLength @intEndPosition,@chrTempString
else
select @intReturnCode=0
if @intReturnCode>0
begin
--????????,????????????????
select @intSearchLength=@intReturnCode
select @chrTempString=substring(@chvItemTitle,@intEndPosition-@intSearchLength+1,@intSearchLength)

--select @chrLogContent =SPACE(8)+ '????????----'+@chrTempString
--execute prAnswerInsertLog 3,"prQuestionAutoAnswer",@chrLogContent
select @intEndPosition=@intEndPosition-@intSearchLength
select @bitSearched=1
if not exists(select * from AnswerNoiseWords where Words = @chrTempString)
begin
select @chvSqlString='insert into #FindProblemResourceInfo(QuestionID,UserID,UserName,UserRole,QuestionTitle,ReadTimes,Answertimes,SubmitDate,thePower) '
select @chvSqlString=@chvSqlString+'select QuestionID,UserID,UserName,UserRole,QuestionTitle,ReadTimes,Answertimes,SubmitDate,' + convert(varchar,@intSearchLength*2)
select @chvSqlString=@chvSqlString+' from Questions '
select @chvSqlString=@chvSqlString+' where CourseID = ' + convert(varchar,@intCourseID)
select @chvSqlString=@chvSqlString+' and ( CONTAINS( QuestionContent,''' + rtrim(ltrim(@chrTempString))+''')'
select @chvSqlString=@chvSqlString+' or CONTAINS(QuestionTitle,'''+rtrim(ltrim(@chrTempString))+'''))'
EXECUTE(@chvSqlString)
select @intAllPower=@intAllPower+@intSearchLength*2

--select @chrLogContent =SPACE(12)+ '??????????????'
--execute prAnswerInsertLog 3,"prQuestionAutoAnswer",@chrLogContent
end
else
begin
select @chrLogContent =SPACE(12)+ '????????'
--execute prAnswerInsertLog 3,"prQuestionAutoAnswer",@chrLogContent
end
end
else
begin
select @intSearchLength=9
if @intSearchLength>@intEndPosition
select @intSearchLength=@intEndPosition
select @bitSearched=0 --???????,0??????
while @intSearchLength>=1 and @bitSearched=0
begin
select @chrTempString=substring(@chvItemTitle,@intEndPosition-@intSearchLength+1,@intSearchLength)
if (select count(*) from AnswerKeywords Where keyword=convert(varbinary,ltrim(rtrim(@chrTempString))) and KeywordLength=@intSearchLength)>0
begin
select @chrLogContent =SPACE(8)+ '????????----'+@chrTempString + ';?????:' + convert(varchar,@intSearchLength)
--execute prAnswerInsertLog 3,"prQuestionAutoAnswer",@chrLogContent

select @intEndPosition=@intEndPosition-@intSearchLength
select @bitSearched=1
if not exists(select * from AnswerNoiseWords where Words = @chrTempString)
begin
select @chvSqlString='insert into #FindProblemResourceInfo(QuestionID,UserID,UserName,UserRole,QuestionTitle,ReadTimes,Answertimes,SubmitDate,thePower) '
select @chvSqlString=@chvSqlString+'select QuestionID,UserID,UserName,UserRole,QuestionTitle,ReadTimes,Answertimes,SubmitDate,' + convert(varchar,@intSearchLength*2)
select @chvSqlString=@chvSqlString+' from Questions '
select @chvSqlString=@chvSqlString+' where CourseID = ' + convert(varchar,@intCourseID)
select @chvSqlString=@chvSqlString+' and (CONTAINS( QuestionContent,''' + rtrim(ltrim(@chrTempString))+''')'
select @chvSqlString=@chvSqlString+' or CONTAINS(QuestionTitle,'''+rtrim(ltrim(@chrTempString))+'''))'
EXECUTE(@chvSqlString)
select @ErrorCode=@@ERROR
if @ErrorCode<>0
begin
select @chrLogContent =SPACE(12)+ '????,???:'+convert(char,@ErrorCode)
--execute prAnswerInsertLog 3,"prQuestionAutoAnswer",@chrLogContent
end
select @intAllPower=@intAllPower+@intSearchLength*2

select @chrLogContent =SPACE(12)+ '??????????????'
--execute prAnswerInsertLog 3,"prQuestionAutoAnswer",@chrLogContent
end
else
begin
select @chrLogContent =SPACE(12)+ '????????'
--execute prAnswerInsertLog 3,"prQuestionAutoAnswer",@chrLogContent
end
end
else
select @intSearchLength=@intSearchLength-1
end
end
if @bitSearched=0
select @intEndPosition=@intEndPosition-1
end
select @chrLogContent = SPACE(4)+'????????'
--execute prAnswerInsertLog 3,"prQuestionAutoAnswer",@chrLogContent

set nocount off

select top 10
QuestionID,
UserID,
UserName,
UserRole,
QuestionTitle,
ReadTimes,
Answertimes,
SubmitDate,
--convert(char,SubmitDate,101) as SubmitDate,
sum(thePower) as thePower,
@intAllPower as AllPower
from #FindProblemResourceInfo
group by QuestionID,QuestionTitle,UserID,UserName,ReadTimes,SubmitDate,SubmitDate,UserRole,Answertimes
order by thePower desc
select @chrLogContent = '??????----prQuestionAutoAnswer'
--execute prAnswerInsertLog 2,"prQuestionAutoAnswer",@chrLogContent

GO
总说:
ADODB.Command 错误 '800a0bb9'

变量或者类型不正确,或者不在可以接受的范围之内,要不就是与其他数据冲突。

恳请指教,谢谢
...全文
105 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
dh20156 2004-10-27
  • 打赏
  • 举报
回复
老办法,替代,用实际的字符或数字替代变量试试
DeltaCat 2004-10-27
  • 打赏
  • 举报
回复
太长了, 看的头晕啊
yaohai 2004-10-27
  • 打赏
  • 举报
回复
看蒙了俺都~~
帮up 一下

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧