1. database.e record numbers & replace data
- Posted by Tony Steward <figjam01 at BIGPOND.COM>
May 04, 2000
-
Last edited May 05, 2000
------=_NextPart_000_000B_01BFB61E.F5BAD700
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I am experimenting with the new database.e, db_replace_data(i,x) does =
not seem to work i keep getting an error expected to see expression not =
procedure.
Also to delete a record you need the record number. How do you get the =
rn and how can you move around by rn.
------=_NextPart_000_000B_01BFB61E.F5BAD700
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I am experimenting with the new =
database.e,=20
db_replace_data(i,x) does not seem to work i keep getting an error =
expected to=20
see expression not procedure.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Also to delete a record you need the =
record number.=20
How do you get the rn and how can you move around by=20
------=_NextPart_000_000B_01BFB61E.F5BAD700--
2. Re: database.e record numbers & replace data
Tony Steward writes:
> I am experimenting with the new database.e,
> db_replace_data(i,x) does not seem to work
> i keep getting an error expected to see expression
> not procedure.
db_replace_data() is a procedure, meaning it does not
return a value. Only functions return values. Some of
the database routines are functions, others are procedures.
Many of the routines return an error code. db_replace_data()
does not - it will call the fatal error handler if you pass it
an invalid record number.
> Also to delete a record you need the record number.
> How do you get the rn and how can you move around by rn.
You can get the record number from the key value for that
record, by calling db_find_key(). If you don't know the
key value, you will have to search for the record by starting
at record number 1 and looping until the record number
given by db_table_size(). e.g.
recnum = 1
while recnum <= db_table_size() do
data = db_record_data(recnum)
if data[1] = 997 and equal(data[2], "Tony") then
db_delete_record(recnum)
end if
recnum += 1
end while
There are no routines such as "get next record" or
"get previous record", since you can
simply increment/decrement the record number to move to
the next/previous record in a table.
Regards,
Rob Craig
Rapid Deployment Software
http://www.RapidEuphoria.com