Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Tn this Param() method what this condition means if(DVLocal.Count > 0)

C#
private string Param()
   {

       for (int i = 0; i < grdViewMachinaryDetailsApproval.Rows.Count; i++)
       {
           CheckBox cb = (CheckBox)grdViewMachinaryDetailsApproval.Rows[i].Cells[2].FindControl("chkSelect");
           if (cb != null)
           {
               if (cb.Checked)
               {
                   ConManager.DBConnection("TERMSHR");
                   ConManager.BeginTransaction();
                   DTLocal = new DataTable();
                   DVLocal = new DataView();

                   strSQL = "select * from tblMachinaryDetails where MDCode = '" + grdViewMachinaryDetailsApproval.Rows[i].Cells[3].Text.ToString() + "'";
                   ConManager.OpenDataTableThroughAdapter(strSQL, out DTLocal, true);
                   DTLocal.TableName = "MachinaryDetails";
                   DVLocal.Table = DTLocal;

                   if (DVLocal.Count > 0)
                   {

                       DRLocal = DVLocal[0].Row;
                       DRLocal.BeginEdit();
                       DRLocal["StateStatus"] = ddlAction.SelectedValue.Trim();
                       DRLocal["ApprovedDate"] = System.DateTime.Now.ToString();
                       DRLocal.EndEdit();

                   }
                   ConManager.SaveDataTableThroughAdapter(ref DTLocal, true);

               }

           }
       }

       return strParam;
   }
Posted

1 solution

DVLocal is a Dataview, so the easier way to find out is to use Google: Google "DataView.Count"[^] - the first hit is a link to MSDN: MSDN: "DataView.Count Property"[^] which tells you all about it.

What is says is that it returns "the number of records in the DataView after RowFilter and RowStateFilter have been applied."

So the line:
C#
if (DVLocal.Count > 0)
will be true if there are any rows in the view, so at least one line to process.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900