I'm using Margaret's Db code and have setup two databases. It is very handy for what I am doing. One for readings and one for settings.
It seems the settings one does not store the record correctly.
Sub Set_SettingsDb
db.Pointer = -1
db.FileName = "settings.dat"
db.Field(0,0) = "servername" :db.Field(0,1)=50
db.Field(1,0) = "serverport" :db.Field(1,1)=10
db.Field(2,0) = "username" :db.Field(2,1)=50
db.Field(3,0) = "password" :db.Field(3,1)=20
db.Field(4,0) = "toaddress" :db.Field(4,1)=50
db.Field(5,0) = "subject" :db.Field(5,1)=50
db.Field(6,0) = "body" :db.Field(6,1)=100
db.Field(7,0) = "" :db.Field(7,1)=0
End Sub
Sub Set_ReadingsDb
db.Pointer = -1
db.FileName = "readings.dat"
db.Field(0,0) = "serialnumber" :db.Field(0,1)=20
db.Field(1,0) = "reading1" :db.Field(1,1)=10
db.Field(2,0) = "reading2" :db.Field(2,1)=10
db.Field(3,0) = "reading3" :db.Field(3,1)=10
db.Field(4,0) = "reading4" :db.Field(4,1)=10
db.Field(5,0) = "dateread" :db.Field(5,1)=30
db.Field(6,0) = "datapacket":db.Field(6,1)=30
db.Field(7,0) = "" :db.Field(7,1)=0
End Sub
I setup the two Subs above to switch between them and they seem to work Ok. The problem seems to be when I leave the program and then go back in. The Settings are first read into the program, but they dont exist when I go back in.
Am I doing something wrong or should I store the database someplace other than dir.Internal?
I have tried this on the emulator and a tablet, they both do the same thing.
I did notice that when I run this in the debugger the Settings database when first opened always has 0 records no matter how many times I start a new debug session. I assume this is normal for the debugger.
Any ideas on what could be going on would be helpful.