This section shows how to create an application that updates the database.
This tutorial demonstrates using connection cache to sampledb when creating
database elements. An alternate approach is to use direct JDBC connection
to sampledb, as demonstrated in “Multipage mobile application tutorial”.
Creating the update application
From Mobile Web Studio, select Applications in the left pane, select New in the Application Manager Status menu, and click the New button to launch Application Builder.
Create a database element:
Click the down-arrow to the right of Add, and select Database Element.
On the Database Element Definition window, make sure the Connection Cache option is selected.
In Conn Cache Name, select sampledb
from
the drop-down list.
In SQL Query String, enter this query for update (you can copy and paste this code from an electronic source):
update sales_order_items set quantity = @OP["quantity"="13"]where id = @OP["id"="-1"] and prod_id = @OP["prod_id"="-1"]
This SQL code updates the database, so no preview is
available. If you try to use Preview, you will receive an error.
Click Next. The Split window displays.
Click Next. The Define window displays.
Click Next. The Filter window displays.
Click Next. The parameter definition window displays, with a list of the parameters used to create the database table.
On the parameter definition window, make these modifications (accept the defaults for all others).
.
Quantity – click the Variable box and make this change:
Select “update” from the “kind” drop-down list.
Click the Variable box next to the other two parameter to make all three parameters available to users to input values, but accept the defaults.
Click Next. The Window Preview window displays.
In Element Name, enter updateOrder
.
Click Next. The Continuous Capture window displays.
On Continuous Capture, click Finish.
In Application Builder, click Save.
In the Finish window, make this change (accept the defaults for all others).
Name – enter updateOrder
(no
spaces).
Click Finish.
Click OK to confirm.
Click Close to exit the Application Builder.
When you return to the Mobile Web Studio main window, select New from the Application Builder Status menu. The updateOrder application displays in the detail pane.
In Mobile Web Studio, approve the application:
Right-click the updateOrder application in the detail pane, and select Approval Status | Approved.
Click OK to confirm.
Select Approved from the Application Manager Status menu. You see your newly approved updateOrder application in the detail pane.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |