错误信息:---------------------------
Debugger Exception Notification
---------------------------
Project AppName.exe raised exception class EOleException with message '无法将 NULL 值插入列 'BookID',表 'lib.dbo.BookStateInfo';该列不允许空值。INSERT 失败。'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
我存储过程中已经对BookID做了处理了为什么还会出现这样的错误,我就很纳闷,希望哪位好心人帮我看一下到底错在哪里
create proc Insert_BookInfo
@ISDN varchar(10),
@BookName varchar(60),
@Author varchar(20),
@price float,
@Press varchar(50),
@PublishDate datetime,
@indate datetime,
@PressAddress varchar(50),
@PressTel varchar(20),
@BookState varchar(8),
@TotalStock integer
as
begin tran
declare @State varchar(10),@BookID varchar(13),@i integer,@BookStock integer,@tempBookID varchar(3)
set @BookStock=@TotalStock
set @i=1
set @State='归还'
while (@TotalStock>=@i)
begin
set @tempBookID=(convert(varchar(3),(select max(convert(int,right(BookID,len(BookID)-10)))+1
from BookStateInfo
where ISDN=@ISDN
)) )
while(len(@tempBookID)<3)
set @tempBookID='0'+@tempBookID
set @BookID=@ISDN+'-'+@tempBookID
insert into BookStateInfo(ISDN,BookID,State)
values(@ISDN,@BookID,@State)
set @i=@i+1
end
insert into BookInfo(ISDN,BookName,Author,price,Press,PublishDate,indate,PressAddress,PressTel,BookState,BookStock,TotalStock)
values(@ISDN,@BookName,@Author,@price,@Press,@PublishDate,@indate,@PressAddress,@PressTel,@BookState,@BookStock,@TotalStock)
commit
GO