[Gambas-user] Managing databases

Leonardo Miliani leonardo at ...1237...
Tue Dec 26 22:58:14 CET 2006


Charlie Reinl ha scritto:
> Salut Leonardo,
> 
> send you an example, a short project, where you can write, look and
> delete records in your AGENDA table.

Thanks a LOT for your project. It helped me to understand the way to
manage DB using Gambas code.
But I didn't find the use of "!" in Gambas documentation...
Is it a way to specify the access to tables, isn't it?

> 
> I didn't understand whats the job of table CODES, so I made a Function
> GetNewID for getting a new counter for code in AGENDA .

In my project I will manage 2 type of contacts, regular customers, that
have long-term relationships, and passing customers, that have sporadic
selling relationships. I will refer to the first ones using Cxxxx where
"C" means customer and xxxx is a unique autoincrement number. I will
refer to the second ones using Pxxxx where "P" means passing and xxxx is
a unique autoincrement number.
I will store the avaible codes for both the types of customers in CODES
table, in 2 separated field.
When I will create a new contact in my AGENDA, I first will access to
CODES and look at the avaible code for my customer (from field Customer
or Passing, as explained above) and then I will add the contact in AGENDA.
Why this?
Because in another part of my project I will have to be able to look in
AGENDA and run some operations if the contact is a "C"ustomer-type, or
other operations in case my contact is a "P"assing-type.
Using a code in format letter+number I will store 2 informations (type
of contact and number of contact) in a single alphanumeric data.

> 
> Keep attention this Function sets his counte + 1 while getting the cout
> of existing records, that can be wrong, if you delete one.

I didn't understand why if I cancel a record, the project cancels ALL
the records.

-- 
Ciao.
Leo.

Web: www.leonardomiliani.com
E-mail: leonardo at ...1237...
Scegli software opensource - Choose opensource software




More information about the User mailing list