Adding data to typed datasets programatically

Hymm

New Member
Why I get a "there is no row at position 0" exception:\[code\]DSGeneral dg = new DSGeneral();// I create 1 tableDSGeneral.GeneralDataTable t = new DSGeneral.GeneralDataTable();dg.Tables.Add(t);// The 1st rowDSGeneral.GeneralRow r = t.NewGeneralRow();r.Code = "code";r.Value = "http://stackoverflow.com/questions/14059511/7";t.Rows.Add(r);// The 2nd rowDSGeneral.GeneralRow r2 = t.NewGeneralRow();r2.Code = "exp";r2.Value = "http://stackoverflow.com/questions/14059511/5";t.Rows.Add(r2);\[/code\]It throws here:\[code\]int numClave = Convert.ToInt16(dg.General[0].Value);\[/code\]Furthermore, debugging I could see that my typed dataset \[code\]dg\[/code\] has 2 tables, I wonder why.
 
Back
Top