alielie
2026-04-23 ef52fd6fd07508883dce4eb002acda59f0169e59
HMI.Core/Util/Sqlite3Helper.cs
@@ -52,6 +52,46 @@
            }
        }
        public long InsertWithId(string Sql)
        {
            try
            {
                if (Sql.EndsWith(";"))
                {
                    Sql += "SELECT last_insert_rowid();";
                }
                else
                {
                    Sql += ";SELECT last_insert_rowid();";
                }
                using (var cmd = new SQLiteCommand(Sql, conn))
                {
                    return (long)cmd.ExecuteScalar();
                }
            }
            catch (Exception ex)
            {
                string message = "ExecuteSql Error:" + ex.Message;
                throw new Exception(message);
            }
        }
        public object SelectOne(string Sql)
        {
            try
            {
                using (var cmd = new SQLiteCommand(Sql, conn))
                {
                    return cmd.ExecuteScalar();
                }
            }
            catch (Exception ex)
            {
                string message = "ExecuteSql Error:" + ex.Message;
                throw new Exception(message);
            }
        }
        public int ExecuteBatch(IEnumerable<string> sqls)
        {
            SQLiteTransaction tr = null;