en_lang.jpg, 1 kB sk_lang.jpg, 1 kB
English Slovak

      Px Framework - ASP.NET components for rapid development of database applications


Menu:



Components of Px Framework:


Row search in the PxWebQuery component according to the value entered and the name of the column where the search shall be carried out



If you need to search in the table of the PxWebQuery component, you can do it via the Find command, see the example below:


         if(wquAdresar.Find("%ško%","name")!=-1)
            lblAdresar3.Text = wquAdresar.Fields["name"].ToString();


Definition of the Find command:

         public Int32 Find(string SearchValue,string sFieldName);


Description of the Find command parameters:

The return value of Find command is ItemIndex (row index, which corresponds to the selection criteria) of the PxWebQuery component, if no row is found, the return value then is -1.

SearchValue - value, according to which the search is, in the column specified in the parameters sFieldName. SearchValue value, we can arrange for example. percent "%" functionality is similar to the SQL command "Like"
sFieldName - column name, which is the search string

Then, the PxWebQuery component enables search according to the primary key, please refer to the example below:

         if (wquAdresar.FindByIdPK(6)!=-1)
            lblAdresar4.Text = wquAdresar.Fields["name"].ToString();

The return value of the FindByIdPK command is ItemIndex (row index, which corresponds to the selection criteria) of PxWebQuery component, if no row is found, the return value then is -1. The valid value of the primary key is entered as a search parameter.

Setting of the cursor position in the row in the PxWebQuery and PxSuperGrid components



Setting of the cursor position in the PxSuperGrid component can be carried out by assigning the 0..RecordCount-1 value to the ItemIndex property of the PxWebQuery component to which the PxSuperGrid component is linked.

         if (wquAdresar.FindByIdPK(6) != -1)
            wquAdresar.ItemIndex = wquAdresar.FindByIdPK(6);


Selection of several rows that match the selection criteria



The PxWebQuery component allows also to select more than one row, if it is possible due to the selection criteria .
The wquAdresar.DataSource () command returns the DataTable object. The DataTable object supports selection, row selection. For more information please refer to the example below:

         //Statement IDs lines that match selection criteria
         DataRow[] dr = null;
         dr = wquAdresar.DataSource().Select("name like '%a%'""name");
         ArrayList aList = new ArrayList();
         Int32 iOrdValue = 0;
         for (Int32 iCykl = 0; iCykl < dr.Length; iCykl++)
         {
            //Here are performed DISTINCT
            if (!aList.Contains(dr[iCykl].ItemArray.GetValue(iOrdValue).ToString()))
            {
               aList.Add(dr[iCykl].ItemArray.GetValue(iOrdValue).ToString());
            }
         }
         string s = String.Empty;
         for (Int32 iCykl2 = 0; iCykl2 < aList.Count; iCykl2++)
         {
            s = s + ", " + aList[iCykl2].ToString();
         }
         lblAdresar5.Text = s;


This routine shall bring us the list of all IDs of the rows, which match the selection criteria, in this case, these are the rows, which contain the letter "a" in the text of "name" column.


Here is a functional example of the PxWebQuery component, even with source code. This functional example on this site runs on MySQL 5.0 database.

No. Example Name Source Codes SQL Script
3.1.1
-10.
Adresar.aspx
Adresar.aspx.cs
SQLScript_MySQL.5.1
SQLScript_MySQL.5.0



Others articles of Px Framework:



It doesn't the intention of this part website, describe in detail the work with PxFramework components, a detailed description of the component available in manual, which can be downloaded here: Download manual of Px Framework