Error Checking In ASP Code
In Kevin Yank's book, he shows how to put in error checking at various stages of working with a database: connecting, querying, etc. I presume the same general principles apply to ASP/SQLServer but I don't know the code. Can someone tell me at what stages I should be checking for errors and some generic code that I could use at each stage?
View Replies
ADVERTISEMENT
I'm setting up a simple competition entry system in ASP where users can enter their name and email address to be added into a prize draw. It's pretty simple stuff, with the data being added into an Access DB table.I've created an index on the 'email' field to stop the same person entering more than once (unless they have more than one address, but let's pretend that's never the case ).Instead of doing a SELECT query to find whether they've entered before, I simply want to attempt to INSERT the data into the table, and if it returns an error along the lines of "no duplicate values in the index" it would give the user an error.My question is, is it possible to display a user-friendly version of the standard ugly ASP generated error message when this error is detected? Or am I stuck with the incredibly unattractive error message we're used to?
View Replies
View Related
I am in the middle of writing a shopping basket which will hold 10,000 or so products. Basically I want to check the performance of my ASP code. I don't want it to keel over and die on me. I did encounter a problem with not closing connections and my site just died on me. I was wondering if you could give me any advice.
View Replies
View Related
I am writing a script that lets me brows the contents of a web server. The problem is the account that is running ASP does not have permissions to every folder. Don't ask me why ... I have no idea but it can't be changed.
What I would like to do is perform a check for:
Microsoft VBScript runtime error '800a0046':Permission denied
And if this happens display an error message saying they do not have permission to view this directory. Code:
View Replies
View Related
How to re-write this so it can error check for each individual field. Username, email, password etc.
This is written and validates if the user already has an account in the Database. then it returns the messaage below. But I would like to indentify if it is the username that exist or the email or password. Code:
View Replies
View Related
why this string fails to check if a user does not enter any data in a field?
<%
' Declaring variables
Dim make, model, description, price, data_source, con, sql_insert
' A Function to check if a field is empty
Function ChkString(string)
If string = "" Then string = " "
ChkString = Replace(string, "'", "''")
End Function
' Receiving values from form
make = ChkString(Request.Form("Make"))
model = ChkString(Request.Form("Model")) and so on and so forth...
%>
View Replies
View Related
what would be the best way to error check a page after I clicked submit but before I go on. Example:
I have a page that dynamically puts text boxes & lists on a page depending upon which button I click on the main menu. What I want to do is check the text boxes for correct values (most likely before I go to the next page which is the Update page). But since I am dynamically creating the page & text boxes I don't know what the names are... I am doing the dynamic page through server side script.
This means that almost all my variables names and anything associated with the dynamic page are in the Server Side script and can't be reached by Client Side script. ok long story short which is best to error check a dynamic page before updating the info on that page. Server Side | Client Side script?
View Replies
View Related
i'm making a forum, and previously i was submitting the form to an asp file, which would check for errors -- if there were errors, it would redirect back to the form with error messages to be displayed -- if it was error free, the message would be written to a txt file.
but then i wanted to put in a preview message page, and so error checking and passing values between the three pages is becoming tricky. so i'm at the point where i'm starting to use javascript to error-check, which works fine for making sure the input is good, but i don't know a good way to notify the user that there are errors with javascript. alert messages are unprofessional, and i can't just add text to the page using javascript.
i'd prefer to use only asp, and i'd prefer it if i didn't have to use an extra asp page JUST to error-check. as it is now i have these pages involved in adding a new subject:
post subject (has the form for the subject and message; the user can click either post message, which will directly write the message, or preview message, which will bring them to a page which displays the post as it would appear once written)
preview message (regardless of what the user clicks, it would come here first to do error checking, and depending on what the user clicked it would either redirect to the page which writes the subject, or display the message;
the problem is, if there are errors with the form, i need to point the user back to post subject without losing whatever info they have already entered. the only way i know how to do that is by submitting a form [i can't use a querystring because it won't maintain the message if the user entered multiple lines in the message])
add subject (this does the backend writing of the message, and is only accessed if the fields have made it through the error-checking)
any solutions in mind on how to pass the field values between these three pages?? or is there a better way i can do error checking??
View Replies
View Related
how to create a form that would handle basic error checking within the ASP itself?
View Replies
View Related
After commands like:
tmpDBconn.Execute("DELETE * FROM mytable WHERE rc_id = 10" )
How do I check for errors?
Is there a way to check the results?
OR:
Set rsCatCount = tmpDBconn.Execute("SELECT COUNT(*) FROM cat WHERE key_id = 10 AND cat_id = 6")
How do I get the count? Do I use rsCatCount(0)?
View Replies
View Related
I tried to display an error detail on my webpage when I got an "HTTP 500 Internal Server Error" of my .asp page, but I was failed I did setup in IIS so it will display debug error on my asp page as well as setting up my browser internet option.
Can you help me how to set it up so I am able to see the error detail on my browser when I get "HTTP 500 Internal Server Error" ( Currently, I just got a blank page with "HTTP 500 Internal Server Error" in the web page title)I run IIS 5.0 and window professional xp browser.
View Replies
View Related
below is my code, i recieve error 500 in the browser, dont know what when wrong. it happen after i delete the Msacees table, and build a new one. Code:
View Replies
View Related
im using CDO for Windows 2000 to send out emails for an application that i developed. the app works, but recently i recieved an error:
8004020F
I looked this up and i this is what i got:
CDO_E_RECIPIENTS_REJECTED 0x8004020FL The server rejected one or more recipient addresses. The server response was: %1.
i have no idea as to why the server rejected some of the addresses. all the addresses are valid.
View Replies
View Related
I get this Microsoft VBScript compilation error '800a0400' on the form processor and everything looks fine.
Microsoft VBScript compilation error '800a0411'
Name redefined
/dene/shout.asp, line 23
Dim i
----^
Maybe you someone can point out my error. Code:
View Replies
View Related
I keep getting the following error message:
Error Type:
Microsoft VBScript runtime(0x800A01A8)
Object required: "
Has anyone else had this?
I can't see an error in my code but am probably missing it.
Here's my code:
View Replies
View Related
can somebody tell me how can i programmaticaly stop sending mail if the asp error code is 0194.
can i do this in 500-100.asp
View Replies
View Related
How can I return an error code from a sql server stored procedure and use it in my asp page to generate an alert indicating that some error has ocurred?
View Replies
View Related
I am trying to set up a staff update page for a local school and have set up a database to record it. I know the database works because I can populate it and display the content. When I went to write the insert statement I get an error that i am unsure how to solve. This is the statement. Code:
SQL = "INSERT INTO staff(first,last,email,position,phoned,job,thedate ) Values " & _
"( '" & first & "', '" & last & "', '" & email & "', '" & position & "', '" & phone & "', '" & job & "', '" & thedate & "')"
View Replies
View Related
here is the code
if ((form1.Decline.value=='') && (form1.OfficeStatus == "YES") &
(form1.FloorBldgDiscStat.value=='')) {
alert('Enter value on floorbldgstat')
return (false);
}
This validation does not work when i try to update my asp page i should prompt the alert msg. My OfficeStatus field is a dropdown with value of "YES" and "NO". What i should i use to get the value "YES" i javascript. Single equal sign(=) or double equal sign (==), and anothe one is what should i use in enclosing the "YES" value. '' or "".
View Replies
View Related
Need help with type mismatch error:
<%
Function CstrN(str)
If IsNull(str) Then
CstrN = ""
Else
CstrN = Cstr(str)
End If
End Function
%>
chkboxvalue = CstrN(RS("field1")) & CstrN(RS("field2"))
Error message:
Microsoft VBScript runtime error '800a000d'
Type mismatch
This error number usually generates when there is spelling or any mismatch variables, etc. I checked and I couldn't find any error. Then, is it the syntax?
View Replies
View Related
The following code has run-time error on "divide by 0" error. I expect
"do the work<br>" will not print in the browser, since it happen after
the code that cause the error. However, this is the output: any ideas why?? Or
this is the nature of ASP scripting language that is being executed in
sequential order? Code:
View Replies
View Related
i have a problem with devoloping an asp program ,that is dynamically generating snapshot files (in .snp format)from
a MS-access database.
database name is datafile.mdb.
Report name is "reportTarge".
here is the asp code for this.
<%
Dim objAccess
Set objAccess = Server.CreateObject("Access.Application")
objAccess.OpenCurrentDatabase "D:Databasedatafile.mdb"
objAccess.DoCmd.OutputTo 3, "reportTarget", "Snapshot Format (*.snp)", "snapshotname.snp"
objAccess.DoCmd.Quit 2
%>
But while executing this asp code ,i am getting the following error in my IE browser.
Error Type:
Server object, ASP 0178 (0x80070005)
The call to Server.CreateObject failed while checking permissions. Access is denied to this object.
What is the reason of this error (while creating instance of the access)?. Is there any problem with my IIS server setting ?If there, how to solve it?
View Replies
View Related
after reinstalling Windows XP (incl. IIS) it is not possible to create new
webs on the local IIS in the likeweise reinstalled Visual Interdev 6.0.
After typing in the name of the desired webserver (machine name or
localhost) the following error comes up: "Method not allowed(Error code =
80070005)". It is however possible to create webs with Interdev on other
webservers in our network.
View Replies
View Related
The employees who use it are not allowed access to the server it's
requried to sit on which means that my username and password have to be
included in the logon.asp page which I HATE! So when this fails, it
publishes my usernanme and password on the screen for the user to
see...brilliant!
Since nobody is willing to create a dummy account is there a way that I
can keep that line of code from displaying if in error? I've added the
code to this thread...
View Replies
View Related
could somebody help me with the ASP code to redirect user to "loginfail.htm" page when an attempt to connect to a database fails.
View Replies
View Related
I'm looking for sample code that will require a use to enter a code from a scued image format.
I'm sure you've seen them before where the image is barely readable by a human and the user has to enter the code correctly to submit the form.
I'm looking for ASP code and NOT ASP.NET code as I am supporting a legacy site.
View Replies
View Related
I have this table that has two columns Department and RecId. what I am doing is I need to give access to different people in different departments. So if I am in billing I say billing 76 which is my rec id and than if I also need acess to accounting I say Accounting 76.
So now in my asp page I open this records set to check and see who has access to what departments and give them the access Code:
View Replies
View Related
I want to check whether the value in recordset is "=> 3 ".
I try "If rs => '3' then...".
But it doesn't seems working. Can I can't check the condition by using the recordset like how i written above?
Or do I need get the value in recordset and assign to a variable in order to check the condition. Please advice.
Let say my rs now stores a value of "2". Can I check with the following code.
[code]
set rs = server.createobject("...")
rs.open "Select...", objconn
if rs >=3 then 'THIS LINE DOESN"T SEEMS WORKING
....
[code]
View Replies
View Related
I want to do some error checking using on resume next to determine whether to commit an ADO transaction. However we have a custom 500 error page which we use through out the rest of the site. Can I remove the on error resume next after I have rolled back the transaction and raise a normal error.
View Replies
View Related
I'm trying to qualify email addresses. Is there any reason why the following line would not catch an email address beginning with "www." ?
ElseIf Left(Session("em"),4) = "www." Then
I put in a dummy email address: www.mydomain@aol.com and it goes through....
<%=Left(Session("em"),4)%> does reflect "www."
why?
View Replies
View Related
Is it possible to have an ASP page which checks if a user is in a certain group in Active Directory (AD). For example jbloggs is logged in and belongs to the group "project_allowed". When jbloggs goes to project.asp it will allow him access
However when jsmith is logged in and belongs to no groups and tries to access project.asp it will deny him access.
View Replies
View Related
The script is designed as a form validator which checks fields for various criteria and then sends a mail with the form contents. Since 40 different forms will be plugged into this script, there needed to be complete seperation between the two.
I've managed it so far by checking for required fields by putting the word 'required' into the name of the field. The script then sources out any fields which has this text and checks them to see if they are filled out.
The problem I've come across now is that I need to check for field length. My idea was to put the amount of characters needed into the name of the field in the form and then have the script check with a Reg Exp. However, Im not too sure of the regular expression needed to check for this.
Can someone suggest one? The one I have at the moment is [1-14] but say I had a field like this: <input type="text" name="passwordrequired12"> That would match bout for 1 and 12. Any ideas?
View Replies
View Related
How can I check whether a variable is set as a value, integer, etc .. ??? (So that when a user submits a value via a web form and its a letter, i can give them an error note.)
View Replies
View Related