Sunday, January 11, 2009

SQL Statement #2

Oke, lets try another SQL Statement.
i was publis little SQL Statement before...
click here if you want to see..

In this tutorial, we will include SQL statement to VB Program.
Actually, we can use any database manipulation by regular

expression or arithmatic expression, but with this way, it tooks
many code and not efficienct.

So, SQL statement simplify our way.

Suppose we have this table:
table name: member
-----------------------------
code name city age
-----------------------------
001 john depok 17
002 erica bogor 20
003 sony jakarta 18
004 wawan depok 16
005 jojo depok 25
-----------------------------

oke, case study:
1. if we to add data...
sql="insert into member values('006','dewi','bogor','18')"
means: add record, code=06, name=dewi, city=bogor, age=18

2. if we want to update data...
sql="update member set name='eric' where code='002'"
means: change erica name into eric

3. if we want to delete data...
sql="delete from member where code='005'"
means: delete the recorde that its code=005

oke, i assume we use adodc1 to connect the database, so how to
embeded SQL statement?
here is the code:

sql="..." [look at each case study above]
adodc1.recordsource=sql
adodc1.refresh


oke, that SQL statement @ glance we'll continue later...