Ok, I've written an application using PocketStudio, I've populated the DB using the application and everything displays properly. So I start writing the conduit to populate the HH DB from a Delphi App. Here is my code:
if not pfgPalmRemoteTable1.Exists then
pfgPalmRemoteTable1.CreateTable;
pfgPalmRemoteTable1.Open;
try
pfgPalmRemoteTable1.EmptyTable;
pfgPalmRemoteTable1.Append;
pfgPalmRemoteTable1.Fields[0].AsString := 'Tom Bombadil1';
pfgPalmRemoteTable1.Fields[1].AsString := 'Ryan';
pfgPalmRemoteTable1.Fields[2].AsString := DateTimeToStr(Now);
pfgPalmRemoteTable1.Fields[3].AsString := 'Normal';
pfgPalmRemoteTable1.Fields[4].AsString := 'Now this is a bloody waste of time...';
pfgPalmRemoteTable1.Post;
finally
pfgPalmRemoteTable1.Close;
end;
In my application only the first field appears populated. Am I using the source incorrectly?
Ryan
I was originally using the FieldByName function but it didn't work either.
I'm not sure what I'm doing wrong. Any suggestions?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately, oneof the most important issues when accessing your Palm data is what your field definitions are - I'm presuming that you've set up the fields at design time. So you should double-check that you've set up string fields, and only specified a size if your Palm side database has fixed width fields.
When dealing with databases that I haven't completely created myself using raw code, I find it best to take the following steps:
1) Have your Palm application create a few dummy records
2) Back up a copy of your database onto the PC. This should be done automatically if you temporarily uninstall your conduit. Or you can use a freely downloadable utility like "Db Explorer.prc" to let you browse your Palm databases and toggle any database for backup
3) Use my PDB Viewer example to look at the contents of the database records
This will let you examine the byte-wise structure of your records. It's always possible that PocketStudio is adding extra data to each record - perhaps a record number, or something like that. Seeing the raw record data is the best way to cross-check your field definitions and make sure you've got them right.
Hope that helps.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok so I set my design-time field sizes to 0 and everything works.
I don't think I understand.
Does the PalmOS automatically assign a max string length to the DB fields or do I. The only reason I'm asking is because, I thought, when I created the DB that I specified field lengths. Which is why I created field lengths in the design-time code. I guess I need to figure out how to limit the size of my data fields.
Thanks for the help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The Palm OS doesn't have any concept of database fields - it treats each record as a simple block of bytes. So the real question is how PocketStudio, it seems, is providing it's own database management system on top of the Palm's.
If the conduit works with 0 length string fields (ie. ASCIIZ resizable strings), then PocketStudio must be providing it's own length checking, and then simply saving the fields as variable length to save room.. otherwise, each string in the records would have a bunch of unused bytes.
If this is the case, go ahead and use variable length strings in your conduit definition, but use some code to make sure the strings don't exceed the size for each field that you set up in PocketStudio for your application.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, I've written an application using PocketStudio, I've populated the DB using the application and everything displays properly. So I start writing the conduit to populate the HH DB from a Delphi App. Here is my code:
if not pfgPalmRemoteTable1.Exists then
pfgPalmRemoteTable1.CreateTable;
pfgPalmRemoteTable1.Open;
try
pfgPalmRemoteTable1.EmptyTable;
pfgPalmRemoteTable1.Append;
pfgPalmRemoteTable1.Fields[0].AsString := 'Tom Bombadil1';
pfgPalmRemoteTable1.Fields[1].AsString := 'Ryan';
pfgPalmRemoteTable1.Fields[2].AsString := DateTimeToStr(Now);
pfgPalmRemoteTable1.Fields[3].AsString := 'Normal';
pfgPalmRemoteTable1.Fields[4].AsString := 'Now this is a bloody waste of time...';
pfgPalmRemoteTable1.Post;
finally
pfgPalmRemoteTable1.Close;
end;
In my application only the first field appears populated. Am I using the source incorrectly?
Ryan
I was originally using the FieldByName function but it didn't work either.
I'm not sure what I'm doing wrong. Any suggestions?
Unfortunately, oneof the most important issues when accessing your Palm data is what your field definitions are - I'm presuming that you've set up the fields at design time. So you should double-check that you've set up string fields, and only specified a size if your Palm side database has fixed width fields.
When dealing with databases that I haven't completely created myself using raw code, I find it best to take the following steps:
1) Have your Palm application create a few dummy records
2) Back up a copy of your database onto the PC. This should be done automatically if you temporarily uninstall your conduit. Or you can use a freely downloadable utility like "Db Explorer.prc" to let you browse your Palm databases and toggle any database for backup
3) Use my PDB Viewer example to look at the contents of the database records
This will let you examine the byte-wise structure of your records. It's always possible that PocketStudio is adding extra data to each record - perhaps a record number, or something like that. Seeing the raw record data is the best way to cross-check your field definitions and make sure you've got them right.
Hope that helps.
Ok so I set my design-time field sizes to 0 and everything works.
I don't think I understand.
Does the PalmOS automatically assign a max string length to the DB fields or do I. The only reason I'm asking is because, I thought, when I created the DB that I specified field lengths. Which is why I created field lengths in the design-time code. I guess I need to figure out how to limit the size of my data fields.
Thanks for the help.
The Palm OS doesn't have any concept of database fields - it treats each record as a simple block of bytes. So the real question is how PocketStudio, it seems, is providing it's own database management system on top of the Palm's.
If the conduit works with 0 length string fields (ie. ASCIIZ resizable strings), then PocketStudio must be providing it's own length checking, and then simply saving the fields as variable length to save room.. otherwise, each string in the records would have a bunch of unused bytes.
If this is the case, go ahead and use variable length strings in your conduit definition, but use some code to make sure the strings don't exceed the size for each field that you set up in PocketStudio for your application.