Insert Into Multiple tables in linq to sql
i m using stored procedure in linq to sql to insert data into two tables.input parameters for sp are subject to two tables and my sp is handling all about inserting in both the tables.question is that how to pass parameters for different table in stored procedure and executing it code side??
my method is taking inputs like this(code-1) :
public bool InsertCashOrChequeCollection(string CustId,string PaidDate,string PenPayID,decimal PaidAmount,string ChequeNo,int Mode,string Remarks,string RecNo,string AgentId,int IsAdjusting)
my linq to sql query(Code-2) :
tbl_Customer_BillTransaction billtrans = new tbl_Customer_BillTransaction();
billtrans.CustTrans_CustId = CustId;
billtrans.CustTrans_PaidDate = PaidDate;
billtrans.CustTrans_PenPayID = PenPayID;
billtrans.CustTrans_PaidAmount = PaidAmount;
billtrans.CustTrans_ChequeNo = ChequeNo;
billtrans.CustTrans_Mode = Mode;
billtrans.CustTrans_Remarks = Remarks;
billtrans.CustTrans_ReceiptNo = RecNo;
billtrans.CustTrans_AgentId = Ag开发者_运维知识库entId;
try
{
dc.tbl_Customer_BillTransactions.InsertOnSubmit(billtrans);
dc.SubmitChanges();
return true;
}
catch
{
return false;
}
i was used to do like this previously but now my sp needs to be changed , one additional parameter is added that int IsAdjusting which belongs to other table then how do i pass it over here in my SP and what would be the changes in code-2 for passing parameter of different table ??
精彩评论