Page 1 of 1

Using DB-pilot to convert database to use in pocketc

PostPosted: Thu Apr 10, 2008 9:58 pm
by tumbleweed
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.

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

PostPosted: Wed Apr 30, 2008 4:30 pm
by kalisco
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.