How to throw error if record not inserted
Last Post 05-01-2009 10:56 AM by Nathan Botts. 5 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
Nathan BottsUser is Offline
wading in the water
wading in the water
Posts:20
Avatar

--
04-28-2009 10:24 AM

    I have a form that appears to successfully submit, but doesn't actually update the table if some of the data entered does not match the correct data type.

    I am trying to control most of this through regular expressions, but is there a straight forward way to let the user know if a record was not inserted?

    David ToUser is Offline
    river guide
    river guide
    Posts:2719
    Avatar

    --
    04-28-2009 11:05 AM
    HI Nathan, the only possible way I can think of is to have a redirection completion event where you pass the user automatically to another page. That way you retrieve the userid and also perform a select query statement on your table to retrieve the last record on your table that belongs to the userid and then depending on the datetime stamp, will set a drop down combox entry to either success or failure. Something like this would work. But your table will need to include the userid as well as a datetime that the entry was written to compare to. -- David
    Nathan BottsUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    04-29-2009 06:56 AM

    Hi David,

     

    You mean I can't just push a button?

     

    As an in between are there any examples of a custom SQL validation script that would do a similar trick?

    David ToUser is Offline
    river guide
    river guide
    Posts:2719
    Avatar

    --
    04-30-2009 06:57 AM
    Nathan, the problem with your scenario is that the SQL form completion event must trigger in order for the SQL to try and insert the record (success or failure). So how do you warn the user? Best and most efficient way in my opinion is through a store procedure:

    Create a store procedure to accept the token values, check for datatype/validity of the tokens and if they are valid, insert the record

    within the store procedure, also call the "xp_sendmail" to send the user email telling them if the record was inserted successfully or it failed.

    Check out the link: http://msdn.microsoft.com/en-us/lib...89505.aspx
    concerning how to use xp_sendmail

    -- David
    David To HostUser is Offline
    going with the flow
    going with the flow
    Posts:54
    Avatar

    --
    05-01-2009 10:48 AM

    HI Nathan, check out this forum on SQL validation. I guess you can create a stored procedure to check for valid data and if it's valid, return a 1 and if not valid, return a 0. Then based on the return value, to warn the user that their data has been inserted or not.  -- David

    Nathan BottsUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    05-01-2009 10:56 AM
    Hi David,

    That definitely looks like the type of fail-safe functionality I am trying to incorporate. I'll dig in to your suggestion and see if I can't get something outlined.

    Thanks, Nathan


    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi