Smart Client and offline Id number



Hello All,

I am programming a smart client application that should, of course,
work offline with most of the functionalities while online. The program
will have a local database that will keep the data till the portable
computer gets online and sync with the main database.

The issue I am having is the person on the field needs to give a case
number or a reference number to the client that must unique all the
time. This number should be the same in both the local and the
centralized database after syncing. I was thinking of using the
following format ddmmyyOnSitePersonIDsequentialNumber or
OnSitePersonIDhhmmssddmmyy. But, what if the RTC battery on the laptop
is bad? that will definitly screw things up.

Any ideas? Is there a Microsoft standart for this issue?

Your help is appreciated.


OHM \( Terry Burns \)

GUID's are definately a well prescribed method of obtaining a unique
reference ( or virtually unique ). However, they are not allways useable
from a human perspective. There are many times that one might perfer a
sequenced incremental value rather than a randomly generated value.

If this is an issue, you may want to consider using an auto number field
with a -1 seed and decrement by 1, when you INSERT into the central
database, these numbers can be converted to a unique numbers.

Me.DataSet11.Tables(0).Columns(1).AutoIncrementSeed = -1

Me.DataSet11.Tables(0).Columns(1).AutoIncrementStep = -1



Thanks everyone. I think I will go with the seed solution. The GUID is
too long.

I really appreciated


Cor Ligthert


The autoincrement has in my opinion very bad behaviour with updating in a
single however even more in a multiuser environment. (It needs forever
reading the dataset new).

Where an uniqueidentifier id should never be used for human purposes in my
opinion, so the lenght is not important.

I prefer as well the GUID

Just to let you know my thought about this.

An advice try it once.

Nice to see you Newbie



Hi Cor,

In our case we need the unique number to be used by humans. We have 50
inspectors who have laptops. After doing the inspection offline they
will print it out with the Case/reference Number and handed out to the
customer. If the customer has a complain they need to refer to that
number to file the complain.

Do you still Suggest the GUID? Isn't there a chance that any of the
inspector will have the get the same GUID for two inspections? This
system will at least be used for 7-10 years. During the 7-10 years we
can not afford to have 1 duplicate or collission.

Do you still advise me to use the GUID ?

Cor Ligthert


I think that I still would use in that situation the Guid as
uniqueidentifier, however beside that a number used as reference number for
your clients by instance y mm dd inspectornr, sequencenr inside day.

In my idea is the autoidentifier in your situation unusable.

When it is created it is -1 -2 and than you have first to update the real
database to get the real number.
What I understand now is not what you are after.

However just my idea.


OHM \( Terry Burns \)

One other alternative is to use a web service to generate the numbers from
a central reservation. There are some issues with this method though,
performance being one of them. One of the most annoying problems is
non-contiguous numbers, if one generates numbers this way, they may never be
used and this allows gaps in the sequence ( depending on how you code it ) ,
to humans, this is a little disturbing. as you want to know why they are

There are other methods I have seen as well, but they all have their own
little issues. This is one of the challenges we face with the disconnected
data model. It's inherently scalable, but you need to think differently.

OHM ( Terry Burns )


Regarding the number I think we will go with the Employee_number +
sequential number. That number will be saved in the local database of
the laptop. once the inspector connects to the network (goes online)
the two databases will sync up. It does not matter if we have a gap in
the primary number. but will there be a negative affect

Tomorrow I will be attending a microsoft event about VS 2005 here in
Ottawa. I will try ask around and will let you know.

Thanks everyone.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question