Click here to Skip to main content
15,663,033 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)

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)
                   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["StateStatus"] = ddlAction.SelectedValue.Trim();
                       DRLocal["ApprovedDate"] = System.DateTime.Now.ToString();

                   ConManager.SaveDataTableThroughAdapter(ref DTLocal, true);



       return strParam;

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:
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