示例#1
0
        public void UpdDs(DataSet Ads, string Aicmd, string [] Aiarg, string Aucmd, string [] Auarg, string Adcmd, string [] Adarg, string Atabs)
        {
            IDbCommand inscmd = _dbhelper.CreateCommand(_con, Aicmd, Aiarg);
            IDbCommand updcmd = _dbhelper.CreateCommand(_con, Aucmd, Auarg);
            IDbCommand delcmd = _dbhelper.CreateCommand(_con, Adcmd, Adarg);

            _dbhelper.UpdateDataset(inscmd, delcmd, updcmd, Ads, Atabs);
        }
        private int SaveinDB(int iCount, EmailQueue email, bool isRemove)
        {
            try
            {
                using (AdoHelper db = new AdoHelper())
                {
                    string     Query = isRemove ? string.Format("DELETE FROM dbo.EmailQueues  WHERE ID={0} AND SiteID={1}", email.ID, email.SiteID) : string.Format("UPDATE EmailQueues SET NumberOfTries={0} , LastAttempt=GETDATE(),LastErrorMessage='{1}' WHERE ID={2} AND SiteID={3}", email.NumberOfTries, email.LastErrorMessage, email.ID, email.SiteID);
                    SqlCommand cmd   = db.CreateCommand(Query, false);
                    iCount = db.ExecNonQuery(cmd, false);
                }

                // iCount += objDbContext.SaveChanges();
                // logger.Log("No of EmailQueue rows affected are : " + iCount, Logger.LogType.EMAILQUEUE);
            }
            catch (SqlException dbEx)
            {
                logger.LogException(dbEx);
            }

            return(iCount);
        }