There is a code for example:
foreach (DataRow row1 in ds.Tables[2].Rows) { if (String.IsNullOrEmpty(row1["clID"].ToString())) { // ΠΊΠ°ΠΊΠΎΠ΅ ΡΠΎ Π΄Π΅ΠΉΡΡΠ²ΠΈΠ΅ dict.Add("{Note}", "ΠΡΠΈΠΌΠ΅ΡΠ°Π½ΠΈΠ΅"); break; } if (!String.IsNullOrEmpty(row1["clID"].ToString())) { // Π΄ΡΡΠ³ΠΎΠ΅ Π΄Π΅ΠΉΡΡΠ²ΠΈΠ΅ dict.Add("{Note}", "ΠΠ°ΠΌΠ΅ΡΠΊΠ°"); break; } }
The result of the procedure:
| ID | clID | +----+------+ | 1 | 1444 | | 2 | 1456 | | 3 | null | | 4 | null |
How to cancel the 2nd if
if the 1st if
is executed.
The problem is that after the first condition is met, it goes to the second one and displays an error
It is necessary if in the table at least one clID is null then the 1st if was executed
if in the table all clID is not null
then the second condition
else if
....... - Alexey Shimanskybreak;
statementbreak;
- Pavel Mayorov