[Gambas-user] Managing databases

Charlie Reinl Karl.Reinl at ...9...
Tue Dec 26 23:37:52 CET 2006


Am Dienstag, den 26.12.2006, 22:58 +0100 schrieb Leonardo Miliani:
> 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?

To the field.

> 
> > 
> > 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.

It's a bug in the project, and not well tested.

replace line 84 by 

con.Delete("AGENDA", "code = &1",id) 

Sorry
Charlie





More information about the User mailing list