Austin Andrews aka Templarian |
3 May 2008
previous page, we started looking at some simple
database operations you can do using SQLite. In this page,
let's continue doing more of the same.
Just like in all SQL, if you know how to insert a record,
you can change the SQL query to update and delete a record.
Create another button called btn_insert and
add the fallowing code:
What’s the use of putting all this data into a database if
you cannot show it off? First create a button called “btn_readrecord”,
and a listbox called “lst_records”, place the code below
into the button:
Most projects require multiple tables to store all the
relational information. And most of the times the tables are
used to organize categories, so a way to find these tables
is needed as shown with the code following code example.
But, first, create a button called btn_tables,
and a Combo Box called cmb_tables. Once you
have done that, then copy and paste the following code:
I have left actually writing and reading
an image out of the examples thus far because it’s optional
and easier to explain out of context. With that said, it is
hard enough that one would be mad if I left it out. If you
are interested to see this included into the other source,
it is a highly recommended to download the source example
I've provided at the end of this tutorial that is based on
the sample code you see here.
For this, simply create a button called
btn_insertimage, a button called
btn_updateimage, a button called
btn_viewimage, and a picture box called
pic_viewer. This example creates a database with a
table called foo with 2 columns and image BLOB. In the
table, one record is inserted and viewable. The image is
always entered into where id is equal to 1.
The code is:
all these code examples and short explanations, you should
be better prepared for your future projects that use SQLite.
Download the source for this project. The source example
is a fully working database editor for a simple database
with an id,
All of which are stored in the databases. It is highly
recommended to read through the source of the example. If
you have any questions, please post on the