Using DB-pilot to convert database to use in pocketc

Discuss PocketC for Palm OS (including Desktop Edition)

Using DB-pilot to convert database to use in pocketc

Postby tumbleweed on Thu Apr 10, 2008 9:58 pm

Hi,
I am trying to read a database that was converted from a text file using DB-PILOT. I made it a "DB" type. The issue I have is I can't read the database with pocketc. The first field of each record should be a string, but when I try to read it, I get a wierd char. Below is the chunk of code.

dbopen("Parts/Assemblies");
Records=dbnrecs();
for (x=0;x<Records;x++){
dbrec(x);
test=dbread('s');
CheckCatList(test);
CurRecNum=x;
text(20,70,Records);
text(20,20,CurRecNum);
text(20,50,CatValue);

}

This code will work with Database I CREATED using pocketc, but not on Parts/assemblies one. It does read the correct number of records with the dbnrecs() command.
Thanks for any suggestions.
tumbleweed
 
Posts: 1
Joined: Thu Apr 10, 2008 9:44 pm

Re: Using DB-pilot to convert database to use in pocketc

Postby kalisco on Wed Apr 30, 2008 4:30 pm

Hi.
As I understand it, and I'm a bit new at databases with PocketC, there's no reason to assume this should work.
The number of records in the database is held in the header file, so this will always be read correctly.
The record itself can hold any data in any way the creator likes.
The PocketC command dbread('s') will only work if the first string is a null-terminated string.
There is no guarantee that this will be true for the database you are using.
If you already have the data as a text file, then the easiest solution would be to use OrbPDB which can be downloaded here : http://www.orbworks.com/other/orbpdb.zip
to convert it to a PocketC database.
Alternatively the Pocket Toolbox library for PocketC has built-in support for PilotDB databases - you can get it from here : http://www.geocities.com/retro_01775/PToolboxLib.zip

Hope this helps.
kalisco
 
Posts: 8
Joined: Wed Apr 16, 2008 8:15 pm


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 5 guests

cron