DroidDB Tip of the Month

DroidDB® Tip for December 2013

Creating a Login Form With a Password

Say you have an application called MyApplication. Say you already created the starting form (also called MyApplication). You may want to password protect your application. Here is how to do this:

  1. Run DroidDB on the desktop, open the MyApplication application, and open the MyApplication form (FILE | OPEN). Select FILE | SAVE AS to save the application and give it the name "Start".
  2. Use DroidDB's FILE | CREATE TABLE command to create a table called PEOPLE. It should contain two columns: NAME and PASSWORD, both of which are of datatype Text. Create an index over the NAME column. When asked if you want to create a form over this table, say YES. Call the form MyApplication.
  3. Disconnect the handheld from the desktop. Close DroidDB on the desktop.
  4. Run DroidDB on the handheld and open MyApplication. Select RECORD | INSERT. Create a username and password. Use RECORD | INSERT and create additional username and passwords as desired. Close the form on the handheld (RECORD | CLOSE).
  5. Reconnect the handheld from the desktop. Run DroidDB on the desktop. Open MyApplication.
  6. Create a form (FILE | CREATE FORM) with no underlying table. Add the following controls to the form:
    • An edit control the user will enter the login name into. Connect this control to @var(37).
    • A second edit control the user will enter the password into. Connect this control to @var(38).
    • A lookup control that searches the PEOPLE table. The search key is @var(37). The column to search is NAME. You DO want the value found to be saved, save it @var(39). Retrieve the PASSWORD columm. In the properties of the lookup control, make the foregound and the background colors the same (so the value does not show).
  7. On the same form, create a macro (EDIT | MACRO/EVENTS). Call the macro LoginMacro. The macro should contain the following steps:

          RECORD | SAVE
          SKIP: if @var(38) = @var(39) then 4 else 0
          ASSIGN: set @var(38) to ''
          ASSIGN: set @var(39) to ''
          MESSAGE BOX: 'Invalid username / password"
          SKIP: 3
          ASSIGN: set @var(38) to ''
          ASSIGN: set @var(39) to ''
          RUN FORM: MyApplication (turn on "Close form")
          RETURN FROM MACRO

  8. Create a button on the form. Change the action from RECORD | CLOSE to RUN MACRO and have the button run the LoginMacro.
  9. Select FILE | SAVE AS and save the form as MyApplication

When the user runs the form, all they have to do is enter the username and password and press the button

 

Back to List »

Visit our store

Top rated! I needed a solid database application development tool for mobile devices. I chose DroidDB for Android OS because it provided a way to get a strong product to market quickly. DroidDB is relational, gives me control over form layout, handles macros, and supports events. It works on all Android versions I have tried and is a great companion product to SYWARE’s VisualCE.

Mark Read, President
SyntegraTech, Inc.

signup for our newsletter