Pls see the attachment. I have created one store procedure and and passing two parameters, one is input and another one is output. The output parameter will return the Auto increment value from SQL server. Hope it would be satify ur req.
Please see "IdentityButton_Click" event in Webform2.aspx.cs. Then u will understand the flow. bsm -----Original Message----- From: Wei Cheng [mailto:[EMAIL PROTECTED] Sent: Friday, November 24, 2006 8:49 AM To: [email protected] Subject: One simple iBatis question-ExecuteNonQuery If I have a SQL Server stored procedure, which takes no parameter and has no returned query result except a return value of integer type-the kind of stored procedure we normally call with ExecuteNonQuery in ADO.NET, what is the optimized way calling it and how could I capture the returned value from the stored procedure? Using QueryForObject? Thanks for the information. Wei Cheng ________________________________________________________________________ ____________ Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com
<?xml version="1.0" encoding="utf-8" ?> <sqlMap namespace="ns_NorthWind" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <!-- XML "behind" document for the People service class. --> <!-- <resultMap id="OrdersSelectResult" class= "NWind_O"> <result property="Id" column="OrderId" /> <result property="CustomerId" column="CustomerId" /> <result property="EmployeeId" column="EmployeeId" /> <result property="OrderDate" column="OrderDate" /> <result property="RequiredDate" column="RequiredDate" /> <result property="ShippedDate" column="ShippedDate" /> <result property="ShipVia" column="ShipVia" /> <result property="Freight" column="Freight" /> <result property="ShipName" column="ShipName" /> <result property="ShipAddress" column="ShipAddress" /> <result property="ShipCity" column="ShipCity" /> <result property="ShipRegion" column="ShipRegion" /> <result property="ShipPostalCode" column="ShipPostalCode" /> <result property="ShipCountry" column="ShipCountry" /> </resultMap> <resultMap id="OrdersDetailsSelectResult" class= "NWind_OD"> <result property="Id" column="OrderId" /> <result property="ProductId" column="ProductId" /> <result property="UnitPrice" column="UnitPrice" /> <result property="Quantity" column="Quantity" /> <result property="Discount" column="Discount" /> </resultMap> --> <alias> <typeAlias alias="NWind" type="ns_NorthWind.cls_NorthWind" /> <typeAlias alias="CustHist" type="ns_NorthWind.CustHist" /> <typeAlias alias="CustMast" type="IBATISapp.CustomerMaster" /> </alias> <resultMaps> <resultMap id="order-od" class="NWind"> <result property="Id" column="OrderId"></result> <result property="OrderDate" column="OrderDate"></result> <result property="ShipVia" column="ShipVia"></result> <result property="ProductId" column="ProductId"></result> </resultMap> <resultMap id="rm-CustHist" class="CustHist"> <result property="Total" column="Total"></result> <result property="ProductName" column="ProductName"></result> </resultMap> <resultMap id="rm-CustMast" class="CustMast"> <result property="CustomerId" column="CustomerId"></result> <result property="CustomerName" column="CustomerName"></result> </resultMap> </resultMaps> <statements> <statement id="Select-od" resultMap="order-od"> Select O.OrderId, O.OrderDate, O.ShipVia, OD.ProductId From Orders O Inner Join [Order Details] OD On OD.OrderId = O.OrderId </statement> <procedure id="pid_CustOrderHist" parameterMap="CustOH-params" resultMap="rm-CustHist"> CustOrderHist </procedure> <procedure id="pid_CustMast" parameterMap="CustMast-params" resultMap="rm-CustMast"> sp_Insert_CustomerMaster </procedure> </statements> <parameterMaps> <parameterMap id="CustOH-params"> <parameter property="CustomerId" column="CustomerId"></parameter> </parameterMap> <parameterMap id="CustMast-params"> <parameter property="CustomerName" column="CustomerName"></parameter> <parameter property="CustomerId" column="CustomerId" direction="Output"></parameter> </parameterMap> </parameterMaps> </sqlMap>
Model.cs
Description: Model.cs
WebForm2.aspx.cs
Description: WebForm2.aspx.cs

