473,503 Members | 2,197 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple DB Column validation

A MS-Access DB table has the following 6 columns - TeacherID, ClassID,
VenueID, AvailDate, StartTime & EndTime. The data type of the 1st 3
columns is int whereas the data type of the last 3 columns is Date/
Time. The AvailDate column stores only the date (& not the time) where
as the last 2 columns store only the time (& not the date). Assume
that the 1st record in the DB table is ClassID=1, TeacherID=1,
VenueID=1, AvailDate=5/15/2007, StartTime=7AM & EndTime=8AM. This
means that ClassID=1 has already been booked by TeacherID=1 at
VenueID=1 on 15th May 2007 from 7AM to 8AM.

Now I have to ensure that no conflicts arise when users enter records
in these 6 columns. The conflicts could be the following:

A teacher cannot teach 2 classses on the same date & at the same time
(be it in the same venue or a different venue). For e.g. TeacherID=1
cannot teach ClassID=1 & ClassID=2 on 15th May 2007 from 7AM to 8AM.
Hence if a user wants ClassID=2 to be taught by TeacherID=1 on 15th
May from 7AM to 8AM, he shouldn't be allowed since ClassID=1 will be
taught by TeacherID=1 on 15th May from 7AM to 8AM (as the 1st row
says).

Likewise, one class cannot be taught by 2 teachers on the same date &
at the same time (be it in the same venue or different venues). For
e.g. ClassID=1 cannot be taught by TeacherID=1 & TeacherID=2 on 15th
May 2007 from 9AM to 10AM. Hence if a user wants TeacherID=2 to teach
ClassID=1 on 15th May from 7AM to 8AM, he shouldn't be allowed to
enter this data in the DB table since ClassID=1 will be taught by
TeacherID=1 on 15th May from 7AM to 8AM.

Similarly, one teacher/class cannot be at 2 venues on the same date &
at the same time. For e.g. TeacherID=1/ClassID=1 can't be at VenueID=1
& VenueID=2 on 15th May 2007 from 11AM to 12PM respectively. Hence if
a user wants TeacherID=1 to teach ClassID=1 on 15th May from 7AM to
8AM at VenueID=2, he shouldn't be allowed to enter this data in the DB
table since ClassID=1 will be taught by TeacherID=1 on 15th May from
7AM to 8AM at VenueID=1.

Also if a user wants to add another row in the DB table where
ClassID=1 will be taught by TeacherID=1 at VenueID=1 on 15th May from,
say, 7:15AM to 8:15AM, this row should not be allowed in the DB table
since the time slot from 7AM to 8AM has already been booked by
ClassID=1 (who will be taught by TeacherID=1); So can TeacherID=1 (or
any oother teacher) start teaching from the middle of a session.

I have made a start but am not exactly confident about it. What I did
is compared each Form inout data with the corresponding columns in the
DB using the following WHERE clause in the SQL query:

SELECT.....WHERE ClassID=Request.Form("classid") AND
TeacherID=Request.Form("teacherid") AND
VenueID=Request.Form("venueid") etc.....

If such a record exists in the DB, then the question of inserting it
in the DB doesn't arise only. So far so good but what do I do if such
a record doesn't exist? Compare the ClassIDs; if ClassID exists, then
next compare TeacherIDs but even if ClassID entered by the user
doesn't exist, that record cannot be inserted in the DB. Under such
circumstances, the next validation that needs to be done is to find
out whether the TeacherID posted by the Form is already booked at the
input VenueID data on the input AvailDate date from input StartTime
data to input EndTime data so on & so forth & this becomes very
confusing.

Can someone help me out with this?

Thanks,

RON

May 13 '07 #1
3 1477
On May 14, 12:10 am, r...@rediffmail.com wrote:
A MS-Access DB table has the following 6 columns - TeacherID, ClassID,
VenueID, AvailDate, StartTime & EndTime. The data type of the 1st 3
columns is int whereas the data type of the last 3 columns is Date/
Time. The AvailDate column stores only the date (& not the time) where
as the last 2 columns store only the time (& not the date). Assume
that the 1st record in the DB table is ClassID=1, TeacherID=1,
VenueID=1, AvailDate=5/15/2007, StartTime=7AM & EndTime=8AM. This
means that ClassID=1 has already been booked by TeacherID=1 at
VenueID=1 on 15th May 2007 from 7AM to 8AM.

Now I have to ensure that no conflicts arise when users enter records
in these 6 columns. The conflicts could be the following:

A teacher cannot teach 2 classses on the same date & at the same time
(be it in the same venue or a different venue). For e.g. TeacherID=1
cannot teach ClassID=1 & ClassID=2 on 15th May 2007 from 7AM to 8AM.
Hence if a user wants ClassID=2 to be taught by TeacherID=1 on 15th
May from 7AM to 8AM, he shouldn't be allowed since ClassID=1 will be
taught by TeacherID=1 on 15th May from 7AM to 8AM (as the 1st row
says).

Likewise, one class cannot be taught by 2 teachers on the same date &
at the same time (be it in the same venue or different venues). For
e.g. ClassID=1 cannot be taught by TeacherID=1 & TeacherID=2 on 15th
May 2007 from 9AM to 10AM. Hence if a user wants TeacherID=2 to teach
ClassID=1 on 15th May from 7AM to 8AM, he shouldn't be allowed to
enter this data in the DB table since ClassID=1 will be taught by
TeacherID=1 on 15th May from 7AM to 8AM.

Similarly, one teacher/class cannot be at 2 venues on the same date &
at the same time. For e.g. TeacherID=1/ClassID=1 can't be at VenueID=1
& VenueID=2 on 15th May 2007 from 11AM to 12PM respectively. Hence if
a user wants TeacherID=1 to teach ClassID=1 on 15th May from 7AM to
8AM at VenueID=2, he shouldn't be allowed to enter this data in the DB
table since ClassID=1 will be taught by TeacherID=1 on 15th May from
7AM to 8AM at VenueID=1.

Also if a user wants to add another row in the DB table where
ClassID=1 will be taught by TeacherID=1 at VenueID=1 on 15th May from,
say, 7:15AM to 8:15AM, this row should not be allowed in the DB table
since the time slot from 7AM to 8AM has already been booked by
ClassID=1 (who will be taught by TeacherID=1); So can TeacherID=1 (or
any oother teacher) start teaching from the middle of a session.

I have made a start but am not exactly confident about it. What I did
is compared each Form inout data with the corresponding columns in the
DB using the following WHERE clause in the SQL query:

SELECT.....WHERE ClassID=Request.Form("classid") AND
TeacherID=Request.Form("teacherid") AND
VenueID=Request.Form("venueid") etc.....

If such a record exists in the DB, then the question of inserting it
in the DB doesn't arise only. So far so good but what do I do if such
a record doesn't exist? Compare the ClassIDs; if ClassID exists, then
next compare TeacherIDs but even if ClassID entered by the user
doesn't exist, that record cannot be inserted in the DB. Under such
circumstances, the next validation that needs to be done is to find
out whether the TeacherID posted by the Form is already booked at the
input VenueID data on the input AvailDate date from input StartTime
data to input EndTime data so on & so forth & this becomes very
confusing.

Can someone help me out with this?

Thanks,

RON
No one who can help me? My bad luck.....Please....can someone PLEASE
help me resolve this complex validation.....PLEEEEEEEASE.....I
desperately need a concrete solution.....I am on the verge of losing
my job.......PLEEEEEEASE.......

RON

May 14 '07 #2
rn**@rediffmail.com wrote:
No one who can help me? My bad luck.....Please....can someone PLEASE
help me resolve this complex validation.....PLEEEEEEEASE.....I
desperately need a concrete solution.....I am on the verge of losing
my job.......PLEEEEEEASE.......
You posted a question on a Sunday and expected a solution already? Sorry,
but that's not the way newsgroups "work". You may wish to consider another
means of getting help - perhaps hiring a programmer who will work to your
schedule, rather than appealing to a group of people with their own lives
and schedules to consider before taking time to tackle a considerably
complicated problem.

If nobody has porovided a solution by tonight, I will try to remember to
take a look at it after work today.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
May 14 '07 #3
On May 14, 3:58 pm, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
wrote:
r...@rediffmail.com wrote:
No one who can help me? My bad luck.....Please....can someone PLEASE
help me resolve this complex validation.....PLEEEEEEEASE.....I
desperately need a concrete solution.....I am on the verge of losing
my job.......PLEEEEEEASE.......

You posted a question on a Sunday and expected a solution already? Sorry,
but that's not the way newsgroups "work". You may wish to consider another
means of getting help - perhaps hiring a programmer who will work to your
schedule, rather than appealing to a group of people with their own lives
and schedules to consider before taking time to tackle a considerably
complicated problem.

If nobody has porovided a solution by tonight, I will try to remember to
take a look at it after work today.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob, after going through your post (especially the last paragraph), I
can at least breathd a sigh of relief. Thanks a lot for that.

Actually the circumstances I am in prompted me for the follow-up post
though I know that it's quite a complicated task. I guess I am
expecting a bit too much from others & I am extremely SORRY for that.
Looking forward to your......

Thanks once again,

Regards,

RON

May 14 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2579
by: Red | last post by:
Hi, I'm not very familiar with Javascript. I usually leave that kind of stuff up to Dreamweaver, but i'm starting to need a little more than it can offer. I have an asp page which creates a...
8
579
by: TJS | last post by:
what are folks doing to get around limitation of one server form per page ?
1
3906
by: Ken Varn | last post by:
If a page has multiple ValidationSummary controls, how does it distinguish which ValidationControls are associated with which ValidationSummary controls? The reason I am asking this is that I...
1
5262
by: cemcat | last post by:
Hello, We have an ASP.NET 2.0 (C#) web form that contains a textbox for users to enter multiple e-mail addresses separated by semicolons. We need to validate that each individual e-mail address...
5
4936
by: paul_zaoldyeck | last post by:
does anyone know how to validate an xml file against multiple defined schema? can you show me some examples? i'm making here an xml reader.. thank you
7
15611
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
3
6221
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store...
8
10460
by: preeny8 | last post by:
Hi guys, So I'm editing an existing database (Access 2003), and I need a bit of help in making a validation rule. My table has many fields, 3 of which are indexed (location, number & revision) ...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4688
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.