示例#1
0
        public static int GetUnUploadCountFromSqlite()
        {
            try
            {
                string sql = string.Format("SELECT count(*) FROM UploadData where IsUpload=0");
                object re  = SqliteDBHelp.GetValue(sql);
                if (re != null)
                {
                    int reint = 0;
                    int.TryParse(re.ToString(), out reint);
                    return(reint);
                }
            }
            catch (Exception e)
            {
                Log4netHelper.LogError(e);
            }

            return(0);
        }
示例#2
0
        /// <summary>
        /// 执行不带参数sql语句,返回所影响的行数
        /// </summary>
        /// <param name="cmdstr">增,删,改sql语句</param>
        /// <returns>返回所影响的行数</returns>
        public static int ExecuteNonQuery(string cmdText)
        {
            int count = 0;

            SqlConnection conn = new SqlConnection(ConnStr);

            try
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand(cmdText, conn);
                count = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Log4netHelper.LogError(cmdText, ex);
                count = 0;
            }
            finally
            {
                conn.Close();
            }
            return(count);
        }