c# - Class defined Datatable, how to leave row [0] unchanged? -


i add rows table configs this, form want

            datarow row2 = dataaccess.instance.configs.newrow();             row2["nome"] = "abrirficheiro";             row2["valor"] = convert.tostring(variables.abrirficheiro);             dataaccess.instance.configs.rows.add(row2); 

but wanna keep row @ index 0 (the first one) untouched, idea how it's done? edit: i've been working around past hour, still unsucessful

the table class code this

public sealed class dataaccess {     static readonly dataaccess instance = new dataaccess();       //**adicionar tabelas aqui     public datatable configs { get; private set; }       // explicit static constructor tell c# compiler     // not mark type beforefieldinit     static dataaccess()     {     }      dataaccess()     {          this.configs = new datatable("configs");           tabelasset.tables.add("configs");          configs.columns.add("nome");         configs.columns.add("valor");     }      public static dataaccess instance     {                 {             return instance;         }     } } 

solved: modified code way

            datarow row2 = dataaccess.instance.configs.newrow();             row2["nome"] = "abrirficheiro";             row2["valor"] = convert.tostring(variables.abrirficheiro);             dataaccess.instance.configs.rows.insertat(row2, 2);              dataaccess.instance.configs.rows.removeat(1);               //second set             datarow row3 = dataaccess.instance.configs.newrow();             row3["nome"] = "mantergravacao";             row3["valor"] = convert.tostring(variables.mantergravacao);             dataaccess.instance.configs.rows.insertat(row3, 3);              dataaccess.instance.configs.rows.removeat(2); 

and on, basicaly, gotta insert first, remove, i'm sure there other ways has been working flawlessly

  dataaccess.instance.configs.rows.insertat(row2,1) 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -