A
A
AleksMo2020-09-08 13:35:06
visual studio
AleksMo, 2020-09-08 13:35:06

Execute lines of code from text file in C# VS?

Good time of the day. Need help!
The file contains the following lines:

table.Cell(i, 0).Range.Text = dr.GetValue(0).ToString();
table.Cell(i, 1).Range.Text = dr.GetValue(1).ToString();
table.Cell(i, 2).Range.Text = dr.GetValue(2).ToString();
table.Cell(i, 3).Range.Text = dr.GetValue(3).ToString();
table.Cell(i, 4).Range.Text = dr.GetValue(4).ToString();


These rows may vary depending on the table, there may be more or less of them!
How to add them from a text file to the loop?
int i = 0;
while (dr.Read())
 // Заполнение клеток (ячеек) таблицы
                {
i++;
//Добавить код выше, который сохранен в текстовом файле
}


Thank you all in advance for your response!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AleksMo, 2020-09-08
@AleksMo

There's a difficult task)) It is necessary during the execution of the program!

V
Vladimir Korotenko, 2020-09-08
@firedragon

It's trash and sodomy. I'll explain why. The file contains purely sharp code, it is fashionable of course to inline it at the time of compilation. But it’s more correct to store at least in jison at least in xml and add these values ​​\u200b\u200bin code. If this is your test task, then answer like that.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question