我要将asp.net中的文本框中的bookname提供给tbllendinginfo。使用该名称我想从另一个表tblbookinfo中获取bookId并将其自动存储到tbllendinginfo.以下代码不显示任何错误。
create procedure inserttotbllendinginfo
@bookname nvarchar(50),
@studentid int,
@noofbooks int,
@dateoflending date
as
begin
update tbllendinginfo
set BookId=bi.BookId
from tbllendinginfo li
inner join tblbookinfo as bi
on(bi.Name)=@bookname
insert into tbllendinginfo (StudentId,NoofBooks,DateOfLending) values(@studentid,@noofbooks,@dateoflending)
end
这是我的程序。我执行输出“O行受影响”
请帮帮我
答案 0 :(得分:0)
试试这个......
update li
set li.BookId=bi.BookId
from tbllendinginfo li
inner join tblbookinfo as bi
on li.BookId=bi.BookId where bi.Name=@bookname