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:


Data loading from the Oracle, MSSQL, MySQL, FireBird, Interbase database by means of the PxWebQuery components



The PxWebQuery component enables easy data loading from the database and facilitates working with thus loaded data.
In our example, the ConnectionString is linked to the ConnectString, and the SQL command relating to the data you want to load is linked to the SQLSelect property. Data loading is then executed by means of the "Open" command.

 protected void Page_Load(object sender, EventArgs e)
 {
   if ((!IsPostBack)&&(wquAdresar.Active==false))
   {
     wquAdresar.ConnectString = "User Id=adr;Password=aa;Data Source=xe;";
     wquAdresar.SQLSelect = "select idadresar , name, address, create_date from Adresar";
     wquAdresar.Open();
   }
 }


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();



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
1.1. 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