Wednesday, January 7, 2009

Insert and Select Operations With ExecuteMethodCall

ALTER PROCEDURE MusInsert

(
@ad varchar(50),
@soyad varchar(50)
)

AS
insert into musteri(ad,soyad) values(@ad,@soyad)
select * from musteri where num=scope_identity()

Stored Proceduremiz önce veri ekliyo sonra eklenmiş olan veriyi geri gönderiyor.


[Function(Name="dbo.MusInsert")]
[ResultType(typeof(musteri))]
public IMultipleResults MusInsert([Parameter(DbType="VarChar(50)")] string ad, [Parameter(DbType="VarChar(50)")] string soyad)
{
var result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), ad, soyad);
return (IMultipleResults)result.ReturnValue;
}

Burada ResultType(typeof(musteri))] ile geri dönecek olan verinin hangi nesne tipinde olduğunu
yazmak gerekir.

No comments:

Post a Comment