Ok, so here's my problem... I'm writing a program that's going to be used by lorry drivers to get their routes. They need to be able to log into the program, then enter the lorry number they're going to use (all the lorrys have 2 digit number IDs)... These 2 entered variables will be stored (presumably) globally and then be used to form the basis of select statements to pull this information out of a database.
Can anybody help me with this? I'm not sure where to even start with it.
I'm developing for Mobile 6 eventually, but at the moment We only have Mobile 5 PDAs to play with I'm hoping I can do the software on Mob5 and it will still work when mob6 comes along?
I was thinking about storing the driver and lorry details in a little SQL database on the PDA but if anybody knows of an easier way of doing this then that would be great!
Thanks in advance for any help anybody can offer me!
Pzy
Last edited by Pzykotik; Aug 8th, 2007 at 03:06 AM.
Hi,
you say the lorry id is used to get information on a database - is that database on the device, or is it on a server and you are using SqlClient?
If you are using a database on the device, I would use that, otherwise you can just store it as a public variable in the code, and use it anywhere, or even put it in a flat file
How steady is this data? It sounds like the routes might change daily, weekly, or whatever. If that is the case, then you would have to be synchronizing the PDA's with some base station, which opens up a whole different set of issues.
If that is not the case, and the routes remain fairly stable over time, then a SQL Server CE database located on removable Flash RAM (like an SD Card) would be the way to go. In fact, it might be the way to go anyhow, because you could update a bunch of databases and distribute them on the SD cards.
The advantage of having the DB on the card, as opposed to RAM, is that some PDA's are set up with a single battery, and when it goes dead you lose the program, the database, etc. There are other PDA's with a second battery that maintains just the RAM for a long time, which reduces the problem considerably.
Thanks, I've changed my first post a little... But on reading it again this morning it still isn't very clear! So I'll try again (answering your questions this time too)...
From what I gather, the routes don't change very often... The spec for this program changes all the time so it's quite hard to keep up.
The driver will log into the PDA using a username/password - he will then have to enter in which lorry he's driving that night using a 2 digit code - The PDA will then download the relevant information on the drivers route for that night and store it in a local database - The drivers route information will be set, daily by the manager on a computer in the office - From what I'm told the PDA's will be able to sync in base stations but will also be required to sync over GPRS as some of the drivers never come back to the office. Now because the route information is pretty stable I was thinking I could store the basics of it on the PDA's local database, just pulling any updates from the server... As long as I can set up the SQL Statements correctly the driver should only be able to see relevant information. The program/database could be stored on a card if necessary (to save the battery issue you pointed out) but as I said, this would still need updating via GPRS on a daily basis.
Just an update... I've made a little login thingy, I've got two textboxes to enter a username and password... an ok and a cancel button, I've written a small database with usernames in and am in the process of figuring out how to check against said database to see if the username/password is valid. Once I've done that I'm thinking I can pull up a new panel to enter in the lorry details (which will use a similar check against another database table to check that those are valid)... If anybody has any idea how to do this it would be great, I'm trying to figure it out now!
Edit.
So I'm going to write the database open thing in a module... This will, I think allow me to call the database whenever I want by just calling a function?
Edit2.
I've just spoken to my line manager... The software and DB are going to be stored on an SD card (still updated at the beginning of the night over GPRS/docking station)
Edit3.
Ok, so I've been trying to find out how to write this module thing all day and I still can't find out! None of the connection strings I try seem to work (they all give me errors!) - Could somebody please tell me how to do one? Once I'm connected to the database I should be able to just write SQL commands to pull the data from it and then manipulate it however I want, I just can't figure out how to connect to the damn database!
Thanks in advance,
Last edited by Pzykotik; Aug 8th, 2007 at 08:23 AM.
The database is on the device... and I have been searching the forums, I've seen loads of people posting on how they connect but I can't get any of them to work! I'm programming for a windows CE 5.0 device if that makes a difference... I haven't a clue what I'm doing!
Thanks! I don't really have any solid code examples to post atm, everything I try has been coming up with errors so I'm just deleting it all and starting again! I'll have a read of that site you just posted and anything I try I'll put here. The database is local, I've added it to the project and created a Binding Source for it. I also have a DataSet (It was created when linking my database to the project, I don't know what it does!)
Edit1.
So I've been reading that site (not for this whole time I was called off for a bit, anyway)
-------------
Imports System.Data.SqlServerCE
Module database
Dim jitDatabase As New SqlCeConnection("Data Source = JIT.sdf")
jitDatabase.Open()
End Module
---------------
I've got that so far, jitDatabase is underlined as being undeclared... I don't know what I'm doing - I added the Imports thingy because it was complaining that SqlCeConnection wasn't defined... I have to go home now, and as my computer still hasn't arrived I can't check for replies to this till tomorrow. I've uploaded my complete project so far, if somebody has the time to have a look at it for me (and maybe fix it) I would be really greatful.
Thanks again! Sorry for being such an idiot with all this!
Pzy
Last edited by Pzykotik; Aug 8th, 2007 at 01:01 PM.