コード例 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(MDL.StockInfoMDL model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into stockinfo(");
            strSql.Append("BarCode,MaterialCode,MaterialName,ScannerID)");
            strSql.Append(" values (");
            strSql.Append("@BarCode,@MaterialCode,@MaterialName,@ScannerID)");
            strSql.Append(";select LAST_INSERT_ROWID()");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@BarCode",      model.BarCode),
                new SQLiteParameter("@MaterialCode", model.MaterialCode),
                new SQLiteParameter("@MaterialName", model.MaterialName),
                new SQLiteParameter("@ScannerID",    model.ScannerID)
            };

            object obj = SQLiteHelper.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #2
0
        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) FROM frontaxleresult ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = SQLiteHelper.GetSingle(strSql.ToString());

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #3
0
 /// <summary>
 /// 获取第一行第一列
 /// </summary>
 /// <param name="sql"></param>
 /// <param name="cmdParms"></param>
 /// <returns></returns>
 public static object ExecuteScaler(string sql, params SQLiteParameter[] cmdParms)
 {
     return(SQLiteHelper.GetSingle(sql, cmdParms));
 }