/*--按作者查询函数--*/create function A_name_search (@Bauthor varchar(30)) returns tableas return(select Sum_Book.Bindex '索引名',Sum_Book.Bname '书名',Sum_Book.Bauthor '作者',C_book '总藏书量', C_book-C_B_Book '可借量'from Sum_Book,Count_Borrowed_Bookgroup by Sum_Book.Bindex,Sum_Book.Bname,Sum_Book.Bauthor,C_book,C_B_Bookhaving Sum_Book.Bauthor like '%'+@Bauthor+'%') go在sql server2005里面的查询语句如下:select * from A_name_search('李')结果如图:在delphi里面的语句如下:procedure TForm5.Button1Click(Sender: TObject);beginadoquery1.SQL.Add('select * from A_name_search(:author)'); adoquery1.Parameters.ParamByName('author').Value:=edit1.Text;adoquery1.ExecSQL;adoquery1.open;end; 结果如图:
- 1 回答
- 0 关注
- 67 浏览
添加回答
举报
0/150
提交
取消