|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Does ASP has try/catch function??
For example, if the user accidentaly insert a duplicate data and an error page will exists. so with 'try/catch' function, it display a proper page. ![]() |
|
#2
|
|||
|
|||
|
depends...if you code using javascript as your SERVER-SIDE language then yes you can, look at one the articles at the beginning of Devshed's web site...there is an article about that!
Otherwise, if you use VBScript as your SERVER-SIDE language you might want to look into: On Error Resume Next ...code... If Err.Number <> 0 Then Response.Write "Number : " & Err.Number & "<br>" Response.Write "Source : " & Err.Source & "<br>" Response.Write "Description : " & Err.Description& "<br>" Response.End End If But On Error Resume Next is *dangerous* be careful ![]() Hope this helps! Sincerely Vlince |
|
#3
|
|||
|
|||
|
So... is there any code that bring the user back to previous page
like this: if error.number <> 0 then 'back to previous page code' end if |
|
#4
|
|||
|
|||
|
Well the thing is that it is *YOU* the programmer that controls the flow of things so I don't really understand what you mean by:
---BEGIN QUOTE--- if the user accidentaly insert a duplicate data ---END QUOTE--- How can the *USER* accidentaly do such a thing? It is *YOU* the programmer that needs to code in such a way that these types of thing doesn't happen no? doesn't that make sense? I mean, assuming you're making an INSERT statement but for some reason you *might* think that this is an existing record, why don't you make a SELECT *first* then INSERT! Even better, put everything in a SPROC(Store Procedure) if using SQL Server That's just a thought! Hope this helps! Sincerely Vlince |
|
#5
|
|||
|
|||
|
well... my problem is like this:
i'm now constructing an admin page which the admin can add quiz questions and answers into database the interface is similiar like this: quizNo Question txtfield AnswerA txtfield AnswerB txtfield Correct Answer txtfield btnNext so, each time the admin/user click the 'next' button, the data will be added into database BUT.... when the admin/user clicked the F5/Refresh button, the duplicate data error page will exist Any way to fix it??? ![]() |
|
#6
|
|||
|
|||
|
What happens after you INSERT the data in your database?
Ok you say it is the users that fill in the questions right? (well ok the admin also because they have access to the web pages obvioulsy) But your application is meant to be used by users right? Ok so the user gets to your ASP page. Starts answering question#1 then the user clicks on the "NEXT" button, you take the values entered by the user and make an INSERT statement, to create an entry in your database, but then what??? do you send the user to question#2 on another ASP page ??? Assumiong you do, then the user is on the asp page of question#2 so no matter how hard/many times he hits the F5 key it will simply refresh the asp page that is on question#2 so that's not a problem right? Do you have an hyperlink so that I can see/test it an understand exactly? Hope this helps! Sincerely Vlince Last edited by Vlince : August 27th, 2003 at 01:11 PM. |
|
#7
|
|||
|
|||
|
Please wait
please wait for a moment, i'm uploading my files
|
|
#8
|
|||
|
|||
|
Done!!!
|
|
#9
|
|||
|
|||
|
there's a javascript recent history option or something like that....google google goo
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > try/catch function??? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|