Warning user before db update
Warning user before db update
am 03.03.2007 19:42:00 von AndyK
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!!
Re: Warning user before db update
am 03.03.2007 21:22:40 von Mike Brind
"AndyK" wrote in message
news:2F803052-B63C-4A02-8DF5-328C7E064F78@microsoft.com...
> 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!!
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
Re: Warning user before db update
am 04.03.2007 08:16:00 von AndyK
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!
"Mike Brind" wrote:
>
> "AndyK" wrote in message
> news:2F803052-B63C-4A02-8DF5-328C7E064F78@microsoft.com...
> > 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!!
>
> 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
>
>
>
Re: Warning user before db update
am 04.03.2007 09:39:19 von John Blessing
"AndyK" wrote in message
news:F2833A6E-D999-46DC-B0F3-17542CD9C198@microsoft.com...
> 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!
>
> "Mike Brind" wrote:
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
Re: Warning user before db update
am 04.03.2007 18:04:36 von AndyK
Thanks John I will try it that way
"John Blessing" wrote:
>
> "AndyK" wrote in message
> news:F2833A6E-D999-46DC-B0F3-17542CD9C198@microsoft.com...
> > 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!
> >
> > "Mike Brind" wrote:
>
>
> 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
>
>
>
Re: Warning user before db update
am 04.03.2007 20:26:30 von Mike Brind
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
"AndyK" wrote in message
news:F2833A6E-D999-46DC-B0F3-17542CD9C198@microsoft.com...
> 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!
>
> "Mike Brind" wrote:
>
>>
>> "AndyK" wrote in message
>> news:2F803052-B63C-4A02-8DF5-328C7E064F78@microsoft.com...
>> > 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!!
>>
>> 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
>>
>>
>>