Sk   En  
 
 
 
 
 
 
 
 

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
      MAXVALUE 1E18
      NOMINVALUE
      NOORDER
      NOCACHE
      NOCYCLE;

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.Insert();
        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";
        wquAdresar.Post();



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. Edit();
                  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";
                  wquAdresar.Post();
If you know the ID of the row, which you want to edit, you can find it in the following way:

                    if (wquAdresar.FindByIdPK(6)!=-1)
                      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.

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



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

 
  PxWebQuery
  PxSuperGrid
  PxEdit
  PxComboBox
  PxCheckBox
  PxJSDatePicker
  PxDbNavigator
  PxLabel
  PxFlyComboBox
  PxGreatRepeater
  PxChart
  PxUploader
  PxFilterView
  PxCheckBoxList
  PxRadioButtonList
  PxLogin
 
 
  AddParamKey()
  AddParamWebQuery()
  AddParamGreatWeb...
  AddParamCheck()
  AddParamFlyCombo...
  AddParamCheckList()
  AddParamRadioList()
  AddParamValidation()
 
 
  AddParamFilter()