1
Answer

multilayer programming insert problem

Erdinc Kolukisa

Erdinc Kolukisa

14y
9.8k
1

hey guys...i want to improve my skills and that is why i develop a project by using multilayer project..but i have a problem which is i cant understand the logic how i will interact DAL layer and Helper layer...i try to add the datas with stored procedure which is like that
ALTER
procedure [dbo].[sp_AddDatas]
(

@firmanin_adi
nvarchar(70),
@firmanin_adresi
nvarchar(max),
@yetkili_ismi
nvarchar(50),
@firmanin_email
nvarchar(50),
@firmanin_email2
nvarchar(50),
@referans_bilgisi
nvarchar(max),
@ntlar_aciklmlar
nvarchar(max),
@gsm_num1
nvarchar(20),
@gsm_num2
nvarchar(20),
@sbt_num
nvarchar(20)
)

as

BEGIN
Set Nocount On
Declare @id int
Select @id =id From Firmalar where firma_adi=@firmanin_adi
If isnull (@id,0)=0
Begin
Insert Into Firmalar (firma_adi,adres,yetkili_ad,email,email2,referans,not_aciklama) Values (@firmanin_adi,@firmanin_adresi,@yetkili_ismi,@firmanin_email,@firmanin_email2,@referans_bilgisi,@ntlar_aciklmlar)
Select @id=@@Identity
Insert Into Telefon (gsm1,gsm2,numara,yetkili_ad,firma_id) Values (@gsm_num1,@gsm_num2,@sbt_num,@yetkili_ismi,@id)
End
Else
Begin
Insert Into Telefon (gsm1,gsm2,numara,yetkili_ad,firma_id) Values (@gsm_num1,@gsm_num2,@sbt_num,@yetkili_ismi,@id)
End
END
i wrote a method in my Helper class to interact with that procedure like below
public
void InsertDatas(Firmalar firma)
{
frm =
new FirmaEklemeFormu();
SqlDataReader dr = d.InsertData();
firma.firma_adi = frm.txtFirma_adi.Text;
firma.adres = frm.txtAdres.Text;
firma.yetkili_ad = frm.txtYetkili_adi.Text;
firma.email = frm.txtEmail.Text;
firma.email2 = frm.txtEmail2.Text;
firma.referans = frm.txtReferans.Text;
firma.not_aciklama = frm.txtNot_aciklama.Text;
}
but i have some other parameters for my stored procedure in another form...i dont know how i can add that data in multilayer design or am i in the right way...i need help guys
Answers (1)