下面是我用在sql server2000中定义的存储过程(只是需要看参数就行,存储过程无错误):
CREATE PROCEDURE check_student_id
@proc_student_id char(20),@check_student_id_message char(50) output,@check_student_id int output
as
declare @proc_student_nbnum int
select @proc_student_nbnum=student_nbnum from student where student_id = @proc_student_id
if(@proc_student_nbnum is null)
   begin
   set @check_student_id_message = '对不起,无该借书证号的存在'
   set @check_student_id = 1
   end
else
   begin
   set @proc_student_nbnum = 8 - @proc_student_nbnum
   set @check_student_id_message = '判断成功,该学生还可以再借'+str(@proc_student_nbnum)+'本书'
   set @check_student_id = 0
   end以上只是需要看参数就行,下面是我的连接procedure Tmainform.input1Exit(Sender: TObject);
var
student_id:String;
begin
student_id:=input1.text;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('check_student_id student_id,student_id_message ,check_return');
adoquery1.ExecSQL;
panduanlabel.Caption:=vartostr(adoquery1.Parameters.ParamByName('check_student_id_message').Value);
end;编译通过,语法没问题,就是在传递参数时出现:
nvachar型转换成int型时出错,好奇怪啊,我没有转换任何成int型,怎么就这样?