This section shows hot 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 a 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.
Click Next. The Split window displays.
Click Next. The Define window displays.
Click Next. The Filter window displays.
Click Next. The Configure Parameters window displays, with a list of the parameters used to create the database table.
On the Configure Parameters window, make these modifications (accept the defaults for all others):
Quantity – click the Variable box, and select ‘update” from the Kind drop-down list.
Click the Variable box next to the other two parameters and 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):
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, right-click the updateOrder application in the detail pane, and select Approval Status | Approved.
Click OK.
Select Approved from the Application Manager Status menu. You see the newly approved updateOrder application in the detail pane.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |