I have a table in my database called Grades which contains a set of columns (named column1, column2 and so forth) each containing different student grades (in the form of strings). In my C# application I would like to change these values through the webservice setGrade() method.
In future I will add more grade columns to the database but I do not want to have to change my code accordingly each time. I tried to write my code such that for each column that exists in the Database table Grades the value "Very good" is inserted. On debugging I am told that I can not use my string "temp" as a command on the webservice record "grade." Is there another way of doing this?
protected void Test()
for (int i = 0; i < myGrades.Length; i++)
string temp = "column" + i;
grade.temp = "Very good"; // I.e. grade.column1, grade.column2, etc.