create procedure datretrieveproductsxml
as
select * from products
for xml auto
go
1 void getproductdetails( int productid,
2 out string productname, out decimal unitprice )
3 {
4 using( sqlconnection conn = new sqlconnection(
5 "server=(local);integrated security=sspi;database=northwind") )
6 {
7 // set up the command object used to execute the stored proc
8 sqlcommand cmd = new sqlcommand( "datgetproductdetailsspoutput", conn )
9 cmd.commandtype = commandtype.storedprocedure;
10 // establish stored proc parameters.
11 // @productid int input
12 // @productname nvarchar(40) output
13 // @unitprice money output
14
15 // must explicitly set the direction of output parameters
16 sqlparameter paramprodid =
17 cmd.parameters.add( "@productid", productid );
18 paramprodid.direction = parameterdirection.input;
19 sqlparameter paramprodname =
20 cmd.parameters.add( "@productname", sqldbtype.varchar, 40 );
21 paramprodname.direction = parameterdirection.output;
22 sqlparameter paramunitprice =
23 cmd.parameters.add( "@unitprice", sqldbtype.money );
24 paramunitprice.direction = parameterdirection.output;
25
26 conn.open();
27 // use executenonquery to run the command.
28 // although no rows are returned any mapped output parameters
29 // (and potentially return values) are populated
30 cmd.executenonquery( );
31 // return output parameters from stored proc
32 productname = paramprodname.value.tostring();
33 unitprice = (decimal)paramunitprice.value;
34 }
35 }
1 create procedure datgetproductdetailsspoutput
2 @productid int,
3 @productname nvarchar(40) output,
4 @unitprice money output
5 as
6 select @productname = productname,
7 @unitprice = unitprice
8 from products
9 where productid = @productid
10 go
樱花校园模拟器4399中文版
樱花校园模拟器4399中文版,十分奇趣好玩的3d校园冒险模拟
我的暑假秘密回忆繁星新春版
我的暑假秘密回忆繁星新春版是一款少女模拟养成类休闲游戏。这款
樱花校园模拟器国际版
樱花校园模拟器国际版,一个超级自由超级好玩的自由恋爱模拟的游
饥荒海难九游版
饥荒海难九游版,带你去真实的海岛上感受一下什么才是真正的孤岛
盖瑞模组体验版最新版
盖瑞模组体验版是玩法非常丰富多元化的沙盒建造游戏,玩家可以在