Esempio n. 1
0
        public static List<AppSettingData> GetAppSettings()
        {
            List<AppSettingData> list = new List<AppSettingData>();

            try
            {
                string sql = "SELECT setting, value FROM app_settings";

                SQLiteCommand command = new SQLiteCommand(sql, LocalSqllite.m_sqlLiteConnection);
                SQLiteDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    AppSettingData data = new AppSettingData();
                    data.m_setting = reader["setting"].ToString();
                    data.m_value = reader["value"].ToString();

                    list.Add(data);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return list;
        }
Esempio n. 2
0
        private void AddToDataGridView(AppSettingData data)
        {
            try
            {
                int nNewRow = dataGridView1.Rows.Add();

                dataGridView1.Rows[nNewRow].Cells[0].Value = data.m_setting;
                dataGridView1.Rows[nNewRow].Cells[0].ReadOnly = true;
                dataGridView1.Rows[nNewRow].Cells[0].Style.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold);

                dataGridView1.Rows[nNewRow].Cells[1].Value = data.m_value;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }