【正文】
可以 通過 Recordset 對(duì)象名 .Filter = adFilterNone 使記錄集回到原來的Recordset對(duì)象的內(nèi)容。 答案 會(huì)。 答案 :用于取消新添加的記錄或取消對(duì)當(dāng)前記錄所做的修改。 答案 : AddNew 和 Update 方法。 答案 有 MoveFirst、 MovePrevious、 MoveNext 和 MoveLast。 答案 BOF 用于判斷結(jié) 果集中記錄的當(dāng)前行指針是否移到了第一條記錄的前邊, EOF 用于判斷結(jié)果集中記錄的當(dāng)前行指針是否移到了最后一條記錄的后邊。 ConnectionString屬性用于建立與數(shù)據(jù)源的連接, CommandType 屬性用于指明命令的類型, RecordSource 屬性用于設(shè)置 ADO 結(jié)果集的內(nèi)容。 答案 : ODBC只能訪問關(guān)系型數(shù)據(jù)庫(kù),而 OLE DB 可以訪問關(guān)系和非關(guān)系型甚至是無結(jié)構(gòu)的數(shù)據(jù)。 答案 :主要通過 DataSource 屬性和 DataField 屬性。 答案 數(shù)據(jù)綁定控件的作用是將結(jié)果集中的數(shù)據(jù)在界面上顯示出來。 答案 : 工程文件的擴(kuò)展名為 .vbp。 答案 : 至少包含兩個(gè)文件:一個(gè)窗體文件和一個(gè)工程文件。 第 16章習(xí)題參考答案 答案 面向?qū)ο蟮目梢暬绦蛟O(shè)計(jì)工具,事件驅(qū)動(dòng)的編程機(jī)制,開放的數(shù)據(jù)庫(kù)訪問功能以及充分利用 Windows 資源。 答案 :會(huì)。 答案 : 不要求。 答案 : 要求不能是簡(jiǎn)單還原模型。而臨時(shí)備份設(shè)備是在備份數(shù)據(jù)庫(kù)時(shí)直接指定的備份文件。 答案 分為永久備份設(shè)備和臨時(shí)備份設(shè)備兩種。 答案 如果想讓數(shù)據(jù)庫(kù)中的 全體 用戶都 具有 某個(gè)特定的權(quán)限, 這時(shí)應(yīng) 將該權(quán)限 授予 public。 答案 : db_owner 答案 public 角色是一個(gè)特殊的數(shù)據(jù)庫(kù)角色,首先, 數(shù)據(jù)庫(kù)中的每個(gè)用戶都 自動(dòng)地是 public 角 色 的成員 。 答案 用戶定義的角色主要是為了權(quán)限管理的煩瑣, 有了角色,就不用直接針對(duì)每個(gè)具體的數(shù)據(jù)庫(kù)用戶來管理權(quán)限,而只需將數(shù)據(jù)庫(kù)用戶放置到合適的角色中 即可。在 SQL Server 2020中, 角色分為系統(tǒng)預(yù)定義的固定角色和用戶根據(jù)自己的需要定義的用戶角色。 答案 : 有對(duì)象權(quán)限、語句權(quán)限和隱含權(quán)限三種類型。 答案 首先必須是服務(wù)器的合法用戶,然后必須是數(shù)據(jù)庫(kù)的合法用戶, 最后必須具有相應(yīng)的操作權(quán)限。 答案 ( 1) create trigger tri1 on Table_SaleBill for insert, update as declare score int select score = Score from inserted update Table_Card set Score = Score + score where CardID in ( select CardID from inserted ) ( 2) create trigger tri2 on Table_SaleBillDetail for insert, update as update Table_SaleBill set PayAmount = ( select sum() from Table_SaleBillDetail a join inserted b on = ) where SaleBillID in ( select SaleBillID from inserted) ( 3) (a) 后觸發(fā)型觸發(fā)器: create trigger tri3_1 on Table_SaleBillDetail for insert, update as if exists(select * from inserted where Discount 40) rollback (b) 前觸發(fā)型觸發(fā)器: create trigger tri3_2 on Table_SaleBillDetail instead of insert, update as if not exists(select * from inserted where Discount 40) insert into Table_SaleBillDetail select * from inserted 第 14章習(xí)題參考答案 答案 分為 對(duì) DBMS 進(jìn)行維護(hù)的權(quán)限和對(duì)數(shù)據(jù)庫(kù)中的對(duì)象和數(shù)據(jù)進(jìn)行操作的權(quán)限兩大類。 return count end ( 3) create function f3(low int, high int) returns table as return ( select CName,Address,GoodsName,SaleDate,Quantity from Table_Customer a join Table_SaleBill b on = join Table_SaleBillDetail c on = join Table_Goods d on = where Age between low and high) ( 4) create function f4(lb varchar(20), nf int) returns table as return (select GoodsName,SaleDate,Quantity,(lb,nf) as total from Table_SaleBill a join Table_SaleBillDetail b on = join Table_Goods c on = join Table_GoodsClass d on = where GoodsClassName = lb and year(SaleDate) = nf) ( 5) create function f5(lb varchar(20)) returns new_table table ( 商品名稱 varchar(30), 單價(jià) money, 銷售日期 datetime, 銷售數(shù)量 int, 銷售總價(jià) money) as begin insert into new_table select GoodsName, SaleUnitPrice, SaleDate,Quantity, Amount from Table_Goods a join Table_SaleBillDetail b on = join Table_SaleBill c on = join Table_GoodsClass d on = where GoodsClassName = lb return end 答案 觸發(fā)器的主要作用是: 完成比 CHECK 約束更復(fù)雜的數(shù)據(jù)約束,為保證數(shù)據(jù)庫(kù)性能而維護(hù)的非規(guī)范化數(shù)據(jù)以及實(shí)現(xiàn)復(fù)雜的業(yè)務(wù)規(guī)則 。 ( 4) create proc p4 as update Table_SaleBillDetail set Discount = case when 10000 then when between 5000 and 10000 then when between 1000 and 4999 then else 1 end from Table_SaleBillDetail a join Table_SaleBill b on = join Table_Card c on = 答案 ( 1) create function (lb varchar(20), nf int) returns int as begin declare sum int select sum = sum(Quantity) from Table_SaleBillDetail a join Table_SaleBill b on = join Table_Goods c on = join Table_GoodsClass d on = where GoodsClassName = lb and year(SaleDate) = nf return sum end ( 2) create function (addr varchar(20)) returns int as begin declare count int select count = count(*) from Table_Card a join Table_Customer b on = where address = addr and State = 39。,mon int as select day(SaleDate), sum(PayAmount) from Table_SaleBill a join Table_SaleBillDetail b on = join Table_Goods c on = join Table_GoodsClass d on = where GoodsClassName = lb and month(SaleDate) = mon group by day(SaleDate) ( 3) create proc p3 lb varchar(20),sum money output as if exists(select * from able_GoodsClass where GoodsClassName = lb) select sum = sum(PayAmount) from Table_SaleBill a join Table_SaleBillDetail b on = join Table_Goods c on = join Table_GoodsClass d on = where GoodsClassName = lb else print 39。 答案 ( 1) create proc p1 lb varchar(20) as select CName,Address,GoodsName,SaleDate,Quantity from Table_Customer a join Table_SaleBill b on = join Table_SaleBillDetail c on = join Table_Goods d on = join Table_GoodsClass e on = where GoodsClassName = lb ( 2) create proc p2 lb varchar(20) = 39。 答案 DECLARE i int, res int SET i = 1 SET res = 5000 while i = 100 begin SET res = res i SET i = i + 1 end print res 答案 :不必相同。