Features | Community | Download | Full Version

Username
Password


Forgot your Login?
Register Now...


Search in Forum

Search in FAQs

Find User

    

  Register now!

If you have received an Instant.EXE webcode enter it here.

Database PlugIn


Database PlugIn


The Database PlugIn for Instant.EXE 3 extends the possibilities to store data beyond INI- and Text files. Connect to a local database file or even a remote database server and access the information using the SQL syntax!

To create and manage local databases, the PlugIn comes with the Instant.EXE 3.0 database administration tool. If you are new to SQL, the query designer included in this tools will help you get things done.

Once connected to a database, the contents is easily accessible from the new Instant.EXE 3.0 system variables that come with the PlugIn. Searching the fields of a database is only one further example of what can be done with this one quick and simple new Instant.EXE 3.0 command.

| Download | Purchase | Internet-PlugIn | Network PlugIn


As a demonstration for the Database PlugIn, here is a small application to store e-Mail addresses:

Before starting to code this example in Instant.EXE 3.0, start the database administration tool (iX_DataAdmin.exe). We will use this tool to create the database that we need to store eMail addresses and associated names. Enter eMail as a database name and hit the create button. The database file (email.mdb) will be created in the directory of the admin tool, but you can copy it were ever you want later on.

Now that the database file exists, we need a table within this database to store our information. Hit the create button in the "tables in database" section and enter a name (e.g. 'data'). Within this table, we need to create some fields that will contain our actual data. Usually, each record in a database is associated with an ID, but for this small example we won't need it, so you can delete that field. Instead, create to fields named 'Email' and 'Name'. Set the field type of both to '202=Text'.

The database is all set. Now you can fire up Instant.EXE 3.0 to use that database within your script.

As usual, first thing is to set up a GUI. Then we'll open the database and wait for user interaction:

Display Window 'E-Mail Address Book' (B=80, H=30, X=71, Y=31, Max. enabled, Inner size)
Display Control Label: activate only. (ID='lblName', X=5, Y=2, B=9, H=4)
Display Control Text box: (ID='inpName', X=20, Y=2, B=50, H=5, read only)
Display Control Label: activate only. (ID='lblEMail', X=5, Y=11, B=12, H=5)
Display Control Text box: (ID='inpEMail', X=20, Y=11, B=50, H=5, read only)
Display Control activate only. (ID='btnNext', X=55, Y=20, B=15, H=5)
Display Control activate only. (X=20, Y=20, B=15, H=5, ID='btnPrev')
Display Control activate only. (ID='btnAdd', X=37, Y=20, B=7, H=5)
Display Control activate only. (X=46, Y=20, B=7, H=5, ID='btnDel')
Database 'D:\asx\src\db_tut\email.MDB' (Table/SQL 'data', open)
Wait infinite...

When the user hits the add-button, two input-boxes will ask for the new contacts name and email address. Then a new dataset is created using the append-option of the database-command. Using the SQL insert-statement, the new contact's data is written to the database. When this is done, the database is closed and reopened to refresh the Instant.EXE 3.0 system variables.

:: iX_Display_Control(btnAdd)
Input "Please enter the name of the contact" in [NewName]
Input "Please enter the eMail-address of the contact" in [NewEmail]
Database '' (append dataset)
Database 'email.MDB' (Table/SQL 'INSERT INTO data (Email, Name) VALUES("[NewEmail]","[NewName]")', open)
Database 'email.MDB' (Table/SQL 'data', close)
Database 'email.MDB' (Table/SQL 'data', open)
Return

The subroutines for the buttons to navigate within the database are very similar, I will only explain the next-button for now. Using the if-command, it is checked whether we have already reached the end of the database. If not, the database-command with the 'Next database'-option is used to get that data. Only thing left to do is write the contents of that dataset to our GUI!

:: iX_Display_Control(btnNext)
If True: '[iX.Dataset.Number]<[iX.Dataset.Count]'
Database '' (next dataset)
Set in [iX.Display.Control(inpName).Text]: '[iX.Dataset.Field Name]'
Set in [iX.Display.Control(inpEMail).Text]: '[iX.Dataset.Field Email]'
End If
Return

Last but not least our application should supply a function to remove contacts from the database. Once again, this can be done with one call of the database-command. The subroutine first checks if there is any data left that can be deleted. If so, the current dataset is removed from the database by using the 'Delete dataset'-option of the database-command. Then the subroutine of the previous-button is called to update the information in the GUI.

:: iX_Display_Control(btnDel)
If True: '[iX.Dataset.Number]>0'
Database '' (delete dataset)
Call iX_Display_Control(btnPrev)
End If
Return

That's all. Easy, isn't it?


**iX202A12 8ABB64MzkJ RS1NYWlsIE FkZHJlc3Mg Qm9va3xXJz gwJ0gnMzAn WCc3MSdZJz MxJ0FFCTAN CjM4CU5hbW U6fEknbGJs TmFtZSdHWC c1J1knMidX JzknSCc0J0 wJMA0KMzgJ fEknaW5wTm FtZSdYJzIw J1knMidXJz UwJ0gnNSdU TwkwDQozOA llLU1haWw6 fEknbGJsRU 1haWwnR1gn NSdZJzExJ1 cnMTInSCc1 J0wJMA0KMz gJfEknaW5w RU1haWwnWC cyMCdZJzEx J1cnNTAnSC c1J1RPCTAN CjM4CT4+fE knYnRuTmV4 dCdHWCc1NS dZJzIwJ1cn MTUnSCc1Jw kwDQozOAk8 PHxHJydYJz IwJ1knMjAn VycxNSdIJz UnSSdidG5Q cmV2JwkwDQ ozOAlBZGR8 SSdidG5BZG QnR1gnMzcn WScyMCdXJz cnSCc1Jwkw DQozOAlEZW x8RycnWCc0 NidZJzIwJ1 cnNydIJzUn SSdidG5EZW wnCTANCjU3 CUQ6XGFzeF xzcmNcZGJf dHV0XGVtYW lsLk1EQnxR J2RhdGEnTw kwDQozMQlF CTANCjAJCT ANCjE5CWlY X0Rpc3BsYX lfQ29udHJv bChidG5BZG QpCTANCjEw CU5ld05hbW U9UGxlYXNl IGVudGVyIH RoZSBuYW1l IG9mIHRoZS Bjb250YWN0 fHwJMA0KMT AJTmV3RW1h aWw9UGxlYX NlIGVudGVy IHRoZSBlTW FpbC1hZGRy ZXNzIG9mIH RoZSBjb250 YWN0fHwJMA 0KNTcJfEgJ MA0KNTcJRD pcYXN4XHNy Y1xkYl90dX RcZW1haWwu TURCfFEnSU 5TRVJUIElO VE8gZGF0YS AoRW1haWws IE5hbWUpIF ZBTFVFUygi W05ld0VtYW lsXSIsIltO ZXdOYW1lXS IpJ08JMA0K NTcJRDpcYX N4XHNyY1xk Yl90dXRcZW 1haWwuTURC fFEnZGF0YS dDCTANCjU3 CUQ6XGFzeF xzcmNcZGJf dHV0XGVtYW lsLk1EQnxR J2RhdGEnTw kwDQo0NQkJ MA0KMTkJaV hfRGlzcGxh eV9Db250cm 9sKGJ0bk5l eHQpCTANCj I5CVtpWC5E YXRhc2V0Lk 51bWJlcl08 W2lYLkRhdG FzZXQuQ291 bnRdfAkwDQ o1Nwl8Tgkw DQoyMglpWC 5EaXNwbGF5 LkNvbnRyb2 woaW5wTmFt ZSkuVGV4dD 1baVguRGF0 YXNldC5GaW VsZCBOYW1l XXwJMA0KMj IJaVguRGlz cGxheS5Db2 50cm9sKGlu cEVNYWlsKS 5UZXh0PVtp WC5EYXRhc2 V0LkZpZWxk IEVtYWlsXX wJMA0KMTgJ CTANCjQ1CQ kwDQoxOQlp WF9EaXNwbG F5X0NvbnRy b2woYnRuUH JldikJMA0K MjkJW2lYLk RhdGFzZXQu TnVtYmVyXT 4wfAkwDQo1 Nwl8UAkwDQ oyMglpWC5E aXNwbGF5Lk NvbnRyb2wo aW5wTmFtZS kuVGV4dD1b aVguRGF0YX NldC5GaWVs ZCBOYW1lXX wJMA0KMjIJ aVguRGlzcG xheS5Db250 cm9sKGlucE VNYWlsKS5U ZXh0PVtpWC 5EYXRhc2V0 LkZpZWxkIE VtYWlsXXwJ MA0KMTcJW2 lYRGF0YXNl dC5Db3VudF 0+MHwJMA0K MjIJaVguRG F0YXNldC5O dW1iZXI9MX wJMA0KMTgJ CTANCjQ1CQ kwDQoxOQlp WF9EaXNwbG F5X0NvbnRy b2woYnRuRG VsKQkwDQoy OQlbaVguRG F0YXNldC5O dW1iZXJdPj B8CTANCjU3 CXxMCTANCj Q0CWlYX0Rp c3BsYXlfQ2 9udHJvbChi dG5QcmV2KX x8CTANCjE4 CQkwDQo0NQ kJMA0K=*




         Contact | Copyright © 2006 XELERATE Software, Inc. All rights reserved.