Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
public void Update(List<businessobjects.tables.item> paramItemDetailCollection)
        {
            string spName = "spupdateItem";
            Database db = DatabaseFactory.CreateDatabase(ConnectionString);
            foreach (FiesSaaS.BusinessObjects.Tables.Item ObjaItem in paramaItemDetailCollection)
            {
                DbCommand dbCommand = db.GetStoredProcCommand(spName);
                db.AddInParameter(dbCommand, "@ItemID", DbType.String, ObjItemDetail.ItemID);
                db.AddInParameter(dbCommand, "@PTypeID", DbType.String, ObjItemDetail.TypeID);
                db.AddInParameter(dbCommand, "@SlNo", DbType.String, ObjItemDetail.SlNo);
                db.AddInParameter(dbCommand, "@BarCode", DbType.String, ObjItemDetail.BarCode);               
                db.ExecuteScalar(dbCommand);
            }

I need to add one more sp for insert details in the above class public void update(...){}.
sp name is spinsertitem.
Posted
Updated 18-Jul-14 2:39am
v2
Comments
Atyant Srivastava 18-Jul-14 1:17am    
you can call the same way you have called the above sp.
string spName = "spupdateItem";
string spNameInsert = "spinsertitem";

DbCommand dbCommandInsert = db.GetStoredProcCommand(spNameInsert);
DbCommand dbCommand = db.GetStoredProcCommand(spName);
//add parameters

db.ExecuteScalar(dbCommandInsert );
db.ExecuteScalar(dbCommand);

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900