Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Database Access / March 2007



Tip: Looking for answers? Try searching our database.

Warning user before db update

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AndyK - 03 Mar 2007 18:42 GMT
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.

Your advice would be most welcome!!
Mike Brind - 03 Mar 2007 20:22 GMT
> hi all
>
[quoted text clipped - 5 lines]
>
> Your advice would be most welcome!!

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 - 04 Mar 2007 07:16 GMT
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!

> > hi all
> >
[quoted text clipped - 15 lines]
> --
> Mike Brind
John Blessing - 04 Mar 2007 08:39 GMT
> hi Mike
>
[quoted text clipped - 12 lines]
>
> Thanks!

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

Signature

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 - 04 Mar 2007 17:04 GMT
Thanks John I will try it that way

> > hi Mike
> >
[quoted text clipped - 17 lines]
> 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
Mike Brind - 04 Mar 2007 19:26 GMT
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

> hi Mike
>
[quoted text clipped - 34 lines]
>> --
>> Mike Brind
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.