Re: Cor..

From: Cor (non_at_non.com)
Date: 02/17/04


Date: Tue, 17 Feb 2004 08:52:10 +0100

Hi Varun,

When I look at your process than I think that I would do it like this.
I do not know if it is a multiuser environment but lets do if it is.

I would take a date (or a date from/to)
    Then do a "select distinct" on all cars where the date matches as free
in the database.
    Set that in a dataset and a dataview
    That should give you all free carmakes on that date which you display in
combobox1.

The user select a carmake in the datacombo1
    Then you do a normal select on your database again with a selection of
the date and the choosen carmake.

You check if you get an empty set, because it can be choosen in the meantime
by another operator.

You shows the Carregs in combobox2 using a dataset and a dataview and let
choose.

You update and check if the Car is not taken in the meantime by using the
errorchecking on concurrency errors.

(If it is taken in the meantime, you tell that on your screen, and start at
the procedure again in my opinon with combobox1)

When it is free and registrated you can make the bill.

I think this is the way I would go.

I hope this helps?

Cor

> Hello Cor,
>
> thank you for responding to my help call.
>
> My data is coming from an sql server database
>
> >>Why are you showing the date if you know that you cannot use it?
> The date is selected using a datetimepicker. It is need as the user can
book another carmake for the same day. i.e even if they already book a ford
car they can still book a Skoda for the same day.
>
> >>What is the dataformat.
> The date is in a dateTime format (short date)
> CarMake is a varchar(30)
> CarReg is VarChar(7)
>
> Date is first selected using the dateTimePicker
> Carmake is then selected using a datareader from database (Combobox)
> CarRegistration is then displayed based on the carMake selected.
(Combobox)
>
> i.e if Porsche 911 is selected registration xxx xxxx and yyy yyyy is shown
in the CarRegistration combobox
> if Ford escort is selected registartion aaa aaaa and bbb bbbb and ccc cccc
is shown
>
> the user then go through each combobox and select the approapraite car.
> Lets say Porsche 911 xxx xxxx was hired for 1/1/2004
> They then click add button and the values are moved to my datatable. and
all comboboxes are reset
>
> The problem i get is that when user goes back to make another hire and
selects the same date and carmake again, (i.e. they select Porsche 911 and
date 1/1/2004, the reg xxx xxxx is stil shown again which allows them to
book same car again and cause duplicate row in my datatable. The application
then crashes.
> The reason it does this is beacause the database has no knowledge that
Porsche 911 xxx xxxx was hired for 1/1/2004 as this is all done in my
dataset. The values retrieved for my combox are from the database. This is
why i wish to remove this registration from the combobox based on the date
and carmake.
>
> Does this make any more sense?
> My wording is not too good. :)
>
>