472,344 Members | 1,259 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,344 software developers and data experts.

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 1427
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
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...
8
by: TJS | last post by:
what are folks doing to get around limitation of one server form per page ?
1
by: Ken Varn | last post by:
If a page has multiple ValidationSummary controls, how does it distinguish which ValidationControls are associated with which ValidationSummary...
1
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...
5
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.. ...
7
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...
3
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...
8
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...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

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.