Groups | Blog | Home
all groups > inetserver asp db > march 2007 >

inetserver asp db : Warning user before db update



AndyK
3/3/2007 10:42:00 AM
hi all

I'm using ASP for a little database application. I can't figure out a
simple design for warning the user before doing an update or append. I need
to check for any other existing records with the same (non-key) data as in
the new or updated record.

Mike Brind
3/3/2007 8:22:40 PM

[quoted text, click to view]

Very easily solved using If... Then ... Else.

Do a select on the database using the fields of data submitted by the user.
If the resulting recordset is EOF, then there is no matching record. If
there is a matching record, stop execution before the insert and write a
message to the screen.

--
Mike Brind

AndyK
3/3/2007 11:16:00 PM
hi Mike

Thanks for responding. I should have made my question clearer, I understand
how to check for EOF in a recordset.

What I needed to know was, I would like to warn the user without needing to
do another round trip to the server, ie I would like to avoid:

- user clicks update
- server script obtains recordset and checks EOF
- server sends client another version of the same page with a warning included

Thanks!

[quoted text, click to view]
John Blessing
3/4/2007 12:00:00 AM

[quoted text, click to view]


The only way you are going to know is by doing a query on the database.
Either do it before so your data entry page has the info it needs to
validate (and that might be a lot of info), or after, once you know what
the user has entered. Personally I would do the latter

--
John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook, find/replace,
send newsletters

AndyK
3/4/2007 9:04:36 AM
Thanks John I will try it that way

[quoted text, click to view]
Mike Brind
3/4/2007 7:26:30 PM
As John said, you can't know if something exists in the database unless you
query it, so you will have to send a server request. A more "user-friendly"
way to do this might be to use the xmlhttprequest object and send a request
via javascript behind the scenes. You get your information from the
database without the page refreshing or the submit button needing to be
clicked.

Use the onlostfocus event of your username/password inputs.

http://www.w3schools.com/ajax

--
Mike Brind

[quoted text, click to view]

AddThis Social Bookmark Button