N
nnhww
Unregistered / Unconfirmed
GUEST, unregistred user!
试写一存储过程
CREATE PROCEDURE dbo.tmpTest
@User_Code varchar(10)
AS
declare @strSQL1 varchar(100)
set @strSQL1='select * from data200208 where 编号='+@User_Code
exec(@strSQL1)
GO
procedure TForm1.Button1Click(Sender: TObject);
begin
sp1.Close;
sp1.Parameters.Refresh;
with sp1 do
begin
Parameters.ParamByName('@User_Code').Value:='1122001000';
Open;
end;
end;
执行时出现"varchar 值 '2202101000'的转换溢出了int列。超出了最大整数值。"
可是Parameters.ParamByName('@User_Code').Value:='3201001000';
就没有出错
D5+SQLSERVER2000
data200208 中“编号” 为char(10)
CREATE PROCEDURE dbo.tmpTest
@User_Code varchar(10)
AS
declare @strSQL1 varchar(100)
set @strSQL1='select * from data200208 where 编号='+@User_Code
exec(@strSQL1)
GO
procedure TForm1.Button1Click(Sender: TObject);
begin
sp1.Close;
sp1.Parameters.Refresh;
with sp1 do
begin
Parameters.ParamByName('@User_Code').Value:='1122001000';
Open;
end;
end;
执行时出现"varchar 值 '2202101000'的转换溢出了int列。超出了最大整数值。"
可是Parameters.ParamByName('@User_Code').Value:='3201001000';
就没有出错
D5+SQLSERVER2000
data200208 中“编号” 为char(10)