Components of Px Framework:
Program inserting of a new row into the database by means of the PxWebQuery component
To insert new rows with the help of the PxWebQuery component you need to create
a sequence, from which the PxWebQuery component shall load a unique ID for
its primary key. The name of the sequence shall be created in the following way.
SEQ_"name of primary key column name"
Therefore, when you create new tables, do not name the primary key column as 'ID' only, but as ID + "table name".
In our example, for the data inserting into the database to work as well, create the sequence by the SQL command:
CREATE SEQUENCE SEQ_IDADRESAR
START WITH 1
INCREMENT BY 1
Attention !!! Of course on other database platforms the sequence is created
in a different way, for more details please refer to the Part Four of
"Specification of using the Px Framework on different database platforms
(Oracle, MS SQL, MySQL, Firebird, InterBase).
Therefore, when you enter the "wquAdresar.Insert ()" command, the PxWebQuery component
automatically calls the sequence, which generates a new ID for the primary key .
You do not have to worry about generation and assigning of a unique key to
the field where the primary key ID is entered.
For more information, please refer to the example below:
wquAdresar.Fields["name"] = "Grof Monte Christo";
wquAdresar.Fields["idpravnaforma"] = " Physical Person";
wquAdresar.Fields["address"] = "Karlovarska 2";
wquAdresar.Fields["create_date"] = "04.07.2010";
wquAdresar.Fields["invalid_adress"] = "N";
Program editing of the existing row in the database by means of the PxWebQuery component
You can edit and modify the existing row just like in the previous example, just replace the
Insert command by the Edit command.
wquAdresar.Fields["name"] = "Juraj Peter Tarnoci";
wquAdresar.Fields["idpravnaforma"] = "Physical person";
wquAdresar.Fields["address"] = "Fatranska 22";
wquAdresar.Fields["create_date"] = "12.10.2010";
wquAdresar.Fields["invalid_adress"] = "N";
If you know the ID of the row, which you want to edit, you can find it in the following way:
lblAdresar4.Text = wquAdresar.Fields["name"].ToString();
In our case, the number 6 is the column ID of the primary key row, which you
are looking for and the search result (i.e. value of the column "name")
is saved in the Label component.
Program deleting of the existing row in the database by means of the PxWebQuery component
Deleting of the existing row can be carried out via the Delete command of
the PxWebQuery component. The FindByIdPK command enables you to find the row
you want to delete, then use the Delete command to delete it.
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
- 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