The continue statement passes control to the next iteration of its closed iteration statement.
Example
In this example, the counter is initially counted from 1 to 10, but(i < 9)
The statement between the end of the continue and for loop body is skipped.
|
Copy code |
// statements_continue.csusing System;class ContinueTest { static void Main() { for (int i = 1; i <= 10; i++) { if (i < 9) { continue; } Console.WriteLine(i); } }} |
Output
Application in actual project
/// <Summary>
/// Save it to the database
/// </Summary>
Public void SaveFileToData (System. Windows. Forms. ProgressBar prg)
{
String SQL = "delete from Pro_ B _ByComPanyInfoData where [Year] = '" + this. tlsCmb. text + "'and ByComPanyID ='" + Pioneer. byCompanyInfo. pubShare. byCompanyID + "'";
Pioneer. OperatorData. Delete (SQL, Pioneer. PublicConnString. GetConnString); prg. Visible = true;
Prg. Minimum = 0;
Prg. Maximum = this. axF1Book1. NumSheets * 100;
For (Int16 I = 1; I <= this. axF1Book1. NumSheets; I ++)
{
AxF1Book1. Sheet = I;
For (int j = 1; j <= 100; j ++)
{
Prg. Value = prg. Value + 1;
String Value = this. axF1Book1. get_EntrySRC (I, j, 3); // The Value entered in the cell
String FiledsID = this. axF1Book1. get_EntrySRC (I, j, 1); // field ID
String FiledsName = this. axF1Book1. get_EntrySRC (I, j, 2); // field name
If (FiledsName. Trim () = "")
{
Continue;
}
String TableName = this. axF1Book1. get_SheetName (I). ToString (); // get the name
String TableID = Pioneer. operatorData. getString ("ID", "Pro_ B _ByComPanyInfo", "Where [Name] = '" + TableName + "'", Pioneer. publicConnString. getConnString );//
String SheetID = I. ToString (); // obtain the form number.
String SheetName = this. axF1Book1. get_SheetName (I). ToString (); // obtain the form name.
String Year = this. tlsCmb. Text; // Year
String ByComPanyID = Pioneer. ByCompanyInfo. PubShare. ByCompanyID; // Number of the audited Organization
SaveDataToDb (Value, FiledsID, FiledsName, TableID, TableName, SheetID, SheetName, Year, ByComPanyID );
}
}
Prg. Visible = false ;}