Example #1
0
 public static void ModifyUserConfig(UserConfig userConfig)
 {
     using (var sqlConn = new SQLiteConnection(ConnectionString))
     {
         try
         {
             sqlConn.Open();
             var cmd = sqlConn.CreateCommand();
             cmd.CommandText = string.Format("update TB_Config set Config=@Config where [Name]='UserConfig'");
             cmd.Parameters.Add(new SQLiteParameter("@Config", ObjectEx.ToBinary(userConfig)));
             cmd.ExecuteNonQuery();
         }
         catch (Exception)
         {
             sqlConn.Close();
         }
     }
 }
Example #2
0
 public static void AddUserConfig(UserConfig userConfig)
 {
     using (var sqlConn = new SQLiteConnection(ConnectionString))
     {
         try
         {
             sqlConn.Open();
             var cmd = sqlConn.CreateCommand();
             cmd.CommandText = string.Format("insert into TB_Config([Name],[Config]) values('UserConfig',@Config);");
             cmd.Parameters.Add(new SQLiteParameter("@Config", ObjectEx.ToBinary(userConfig)));
             cmd.ExecuteNonQuery();
         }
         catch (Exception)
         {
             sqlConn.Close();
         }
     }
 }