ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old August 7th, 2003, 08:21 AM
minkisi minkisi is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 11 minkisi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 13 sec
Reputation Power: 0
Confirmation of INSERT in ASP/MySQL

I wrote an ASP prgram to insert a row into a MySQL database using data from a form. It works just fine, however is there a way to check a return code and trap any error that may occur (duplicate row error for example) so I can format and display a message in the browser instead of having the error just show up?

I've been looking in my ASP & MySQL books and searching on the web but can't find anything that sounds like what I want to do.

Thanks for any help.
Marilyn

P.S. I'm going away for a few days, so if I don't answer right away, don't think I'm not interested in any answers you may post!

Reply With Quote
  #2  
Old August 7th, 2003, 08:55 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
One thing you might want to look into is writing, at the top of your page,

On Error Resume Next

then write you code

Then write something like:

If Err.Number <> 0 Then
...Trap the error here...
End If


Hope this helps!
Sincerely

Vlince

NOTE: On Error Resume Next can be tricky so be careful while using it!

Reply With Quote
  #3  
Old August 7th, 2003, 11:18 AM
minkisi minkisi is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 11 minkisi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 13 sec
Reputation Power: 0
Thanks Vlince - that worked!!

Marilyn

Reply With Quote
  #4  
Old August 9th, 2003, 12:10 AM
zimm zimm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 30 zimm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
you might also try a select statement on the key fields from the table to which you want to insert. if the rs comes back bof/eof, you know that you can safely insert your data into the db.

Reply With Quote
  #5  
Old August 13th, 2003, 08:06 AM
minkisi minkisi is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 11 minkisi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 13 sec
Reputation Power: 0
Zimm,

Thanks for the suggestion. That is a good way to prevent problems beforehand. It is also something I can use in other cases as well.

Marilyn

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Confirmation of INSERT in ASP/MySQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway