0

Hello,
I am creating my project now and I am using Dreamweaver CS3 ASP VBScript and Access 2007.

Can you teach me how to restrict the database to add only three records on the table;
say, a student has a MemberNo and he can only use his MemberNo to borrow books three times;

And if the data is already inserted three times, a message will popup or appear saying,
"You have reached the limit of borrowing books"
I wonder where should I do that? In Access or Dreamweaver?

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by jcarbillon
0

You can simply create a column named say 'BorrowCount' and let the initial value be zero(0). Once there's a new entry from the user, this value can be incremented by one and once it gets to three, you can provide your error message. Note that this would require your application querying the database to get the latest number of times the user has borrowed books on any new entry.

0

Thank you so much Netcode for posting your reply. I got your idea. Btw what do you mean by "Note that this would require your application querying the database to get the latest number of times the user has borrowed books on any new entry."? How can i do that?

0

he means you need to query first and get the value of borrowcount before you proceed on inserting new records.

this is how i see it

sql = "select borrowcount from table"

if borrowcount <= 3 then

sql = "insert into ***********"

else

'alert the user

end if

if you want you don't need to add another column for borrow count, just query first using "select count as borrowcount from table where *****", from there you can get the number of records.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.