Create an embedded database application with single line of code

This tutorial will explain the steps involved in creating simple embedded database application written in Visual Basic, a relatively straightforward affair. It assumes that you have osenxpsuite 2007 installed on your machine.

Opening the Application

Open Visual Basic and Select new project from the file menu. Select OsenXPSuite 2007 Enterprise Edition from the new project dialog box and click ok.

Adding Controls

Add:
  • OsenXPPicture control
  • OsenXPTextBox control
  • MyADODC control
  • Label control

Adding Code


Private Sub Form_Load()

MyADODC1.InitSQLite3DB "addbook", "", txtData, picPhoto, App.Path & "\addressbook.db3", "xp", "create table addbook(contactid integer primary key autoincrement,contactname text,companyname text,address text,city text, state text,postalcode text,country text,phone text,email text,photo blob);"

End Sub

Syntax

object.InitSQLite3DB TableName, [Condition], [TextObject], [PictureObject], [DB_filename], [pwd], [ddl_SQL], [SQLCN]
The InitSQLite3DB Method syntax has these parts:

Part Description
object An expression evaluating to an object of type MyADODC.
TableName Required. A String value. Specify the name of table object at the database which would you like to open.
Condition Required. A String value. (e.g: "Where country = 'USA' ")
TextBoject Optional. An OsenXPTextBox object. Specify the name of osenxptextbox which you bind with MyADODC control.
PictureObject Optional. An OsenXPPicture object. Specify the name of OsenXPPicture which you bind with MyADODC control.
DB_filename Optional. A String value. Set the database file which you want to open, if the database file not found, the sqlite3 engine will create a database file automatically.
pwd Optional. A String value. Set the password for opened a database
ddl_SQL Optional. A String value. Set the DDL statement. This query (DDL) will be execute while the specified table not found.
SQLCN

Optional. An SQLite3_Connection object. If you have an active SQLite3_connection, you can empty the parameter for DB_filename and pwd, So you just provide this parameter which the SQLite3_connection object that you have.


Testing Application



AddressBook.zip (5 Kb)