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.
Others articles of Px Framework:
- PxWebQuery - component for working with databases
- PxSuperGrid - component for the direct display of data in the table
- PxEdit - component for data editing, similar to the TextBox component
- PxComboBox - component for selecting data from a list, similar to the DropDownList component
- PxCheckBox - component for checking the value (Check / UnCheck value)
- PxFlyComboBox - set of the consecutively linked comboboxes, suitable for the work with structured data (for example: selection of category and subcategory)
- PxGreatRepeater - component for entering data with repeating structure, maximum number of values is limited
- PxJSDatePicker - component for the date entry, based on the JavaScript
- PxDbNavigator - the component for the work with the PxWebQuery components, row cursor movement, etc.
- PxLabel - component for data display
- PxCheckBoxList - component to view and select values from the list
- PxRadioButtonList - component for view and selection of a value from the list
- PxChart - the component for displaying and working with charts
- PxFilterView - visual component for filtering the table data contents in the PxWebQuery component
- PxUploader - component for uploading binary and text files to the server
- PxLogin - component for authorization and logging into the application
- Data loading from the Oracle, MSSQL, MySQL, FireBird, Interbase database by means of the PxWebQuery components
- Program inserting, editing or deleting of row into the database by means of the PxWebQuery component
- Loading values from the PxWebQuery component via the while cycle
- Row search in the PxWebQuery component according to the value entered and the name of the column where the search shall be carried out
- The "ReOpen" procedure of the PxWebQuery component and data re-load into the PxWebQuery component
- Validation, checking of the entered values by means of the PxWebQuery component and other visual components (PxEdit, PxComboBox, etc.)
- Events of the PxWebQuery component
- A special function GetValueFromStructKey of the PxWebQuery component
- Setting the language mutation of the Px Framework
- Finding the current version of the 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