473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

error checking doesn't appear to be working

Below is my ASP page, I have changed the update to read DRIAL which doesn't
exist, shouldnt this throw an error, or if the connection cannot be made
shouldnt it throw an error as well

thanks in advance

<%@language="VBScript"%>
<% option explicit %>
<% response.buffer = True %>

<%
dim telNo, comp, adbTable
telNo = request.form("telNo")

response.write telno & "<BR>"
comp = inStr(1, telNo, " ", 1)

if comp <> 0 then
response.redirect "phone.asp?QS=yes&num=" & telno
end if
%>

<%
Dim conn, RS, strSQL, strConnImpreza, strConnDom_Con,
strConnImprezaTouchStar

'connection details
<% server.execute ("connections.inc") %>
'error checking starts here, if an error is encountered display a msg to the
user and carry on
on error resume next

conn.open strConnImpreza

'this sql statement can be run on both impreza and dom_con tables Amcat'
strSQL = "INSERT INTO MasterDoNotCall(phonenum) VALUES ('" & telNo & "');"
conn.execute strSQL 'run the sql statement

disperror("imprezanocall") 'call the error function

response.write strSQL & "<BR>"
conn.close 'close the connection'
conn.open strConnDom_Con 'open the connection to dom_con'

strSQL = "INSERT INTO MasterDoNotCall(phonenum) VALUES ('" & telNo & "');"
conn.execute strSQL

disperror("DomConNoCall")

response.write strSQL & "<BR>"
conn.close
'for this table we need to run two sql statements, first open the
connection'
conn.open strConnImprezaTouchStar
disperror("connTouchstar")

strSQL = "INSERT INTO Nevercall (PhoneNum, EffectiveDate) " & _
"VALUES ('" & telNo & "', Getdate())"
conn.execute strQSL

disperror("imprezaTouchstarNC")

response.write strSQL & "<BR>"

strSQL = "UPDATE DIAL SET CRC = 'DNC' WHERE PhoneNum = '" & telNo & "';"
conn.execute strSQL

disperror("imprezaTouchstar")

response.write strSQL & "<BR>"
conn.close
set conn = nothing
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Updated Databases</title>
<style>
<!--
body { font-family: arial, helvetica, sans-serif; font-size: 10px; }
//-->
</style>
</head>

<body>
Detail have been inserted into the corresponding databases
</body>
</html>
<%
sub dispErr(adbTable)
' if an error is raised then trap it here and end processing
IF err.number <> 0 then
%>

<p>Record already exists on the server and table.</p>
<%
SELECT CASE adbTable
case "imprezanocall" %>
<p>Server: Impreza, Database: AMcat, Table: MasterDonotcall; Was not
updated</p>
<% case "DomConNoCall" %>
<p>Server: Dom_Call, Database: AMcat, Table: MasterDonotcall; Was not
updated</p>
<% case "imprezaTouchstar" %>
<p>Server: Impreza, Database: Touchstar, Table: Dial; Was not
updated</p>
<% case "imprezaTouchstarNC" %>
<p>Server: Impreza, Database: Touchstar, Table: Nevercall; Was not
updated</p>
<% case "connTouchstar" %>
<p>Connection to Touchstar failed</p>
<% END SELECT
end if
Err.Clear

end sub
%>
Jul 19 '05 #1
3 1589

"Tarwn" <Ta***@discussions.microsoft.com> wrote in message
news:31**********************************@microsof t.com...
"Steven Scaife" wrote:
<%
Dim conn, RS, strSQL, strConnImpreza, strConnDom_Con,
strConnImprezaTouchStar

'connection details
<% server.execute ("connections.inc") %>

Your first error is in the last line I pasted above. Since you are already
in an ASP script block you cannot (and do not need to) enter another

script block in order to execute the Server.Execute call. If you weren't receiving an error on this line (at te very least) then you mayhave deaper problems, as this line is a syntax error that occurs before your On Error Resume Next

-T


In my page that line isn't there, the strings of my connection are there, i
just put that there to show that some form of connection method is there,
didn't wanna show the different server connection strings, paranoia on my
part
Jul 19 '05 #2
That explains a lot, I was trying to figure out how you would not be getting
an error in that situation :)

I've looked through the rest of your code and if it is a logic error, I am
not seeing it. My assumption is that the line you rendered inoperable was
the last SQL entry.

An error should be thrown at that point, something to the effect of table
not found. What type of database are you operating on (MS Access, SQL Server,
etc)? Not sure it will matter but it may.

One thing I would try is to cut it down to the minimal amount of code to try
and duplicate the lack of error. Comment out everything except the connection
string, creation of the connection object, the sql string, execution of the
sql string, and a one line "If err.number <> 0 Then Response.Write
err.description"

If you get the error in that case then uncomment the
dispError("imprezaTouchstar") line. Etc. Work your way from the most simple
to the most broad.

-T
Jul 19 '05 #3
Just noticed why it wouldn't work, i am calling disperror instead of
disperr. Doh!

thanks for the help

"Steven Scaife" <sp@nospam.com> wrote in message
news:eS*************@tk2msftngp13.phx.gbl...
Below is my ASP page, I have changed the update to read DRIAL which doesn't exist, shouldnt this throw an error, or if the connection cannot be made
shouldnt it throw an error as well

thanks in advance

<%@language="VBScript"%>
<% option explicit %>
<% response.buffer = True %>

<%
dim telNo, comp, adbTable
telNo = request.form("telNo")

response.write telno & "<BR>"
comp = inStr(1, telNo, " ", 1)

if comp <> 0 then
response.redirect "phone.asp?QS=yes&num=" & telno
end if
%>

<%
Dim conn, RS, strSQL, strConnImpreza, strConnDom_Con,
strConnImprezaTouchStar

'connection details
<% server.execute ("connections.inc") %>
'error checking starts here, if an error is encountered display a msg to the user and carry on
on error resume next

conn.open strConnImpreza

'this sql statement can be run on both impreza and dom_con tables Amcat'
strSQL = "INSERT INTO MasterDoNotCall(phonenum) VALUES ('" & telNo & "');"
conn.execute strSQL 'run the sql statement

disperror("imprezanocall") 'call the error function

response.write strSQL & "<BR>"
conn.close 'close the connection'
conn.open strConnDom_Con 'open the connection to dom_con'

strSQL = "INSERT INTO MasterDoNotCall(phonenum) VALUES ('" & telNo & "');"
conn.execute strSQL

disperror("DomConNoCall")

response.write strSQL & "<BR>"
conn.close
'for this table we need to run two sql statements, first open the
connection'
conn.open strConnImprezaTouchStar
disperror("connTouchstar")

strSQL = "INSERT INTO Nevercall (PhoneNum, EffectiveDate) " & _
"VALUES ('" & telNo & "', Getdate())"
conn.execute strQSL

disperror("imprezaTouchstarNC")

response.write strSQL & "<BR>"

strSQL = "UPDATE DIAL SET CRC = 'DNC' WHERE PhoneNum = '" & telNo & "';"
conn.execute strSQL

disperror("imprezaTouchstar")

response.write strSQL & "<BR>"
conn.close
set conn = nothing
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Updated Databases</title>
<style>
<!--
body { font-family: arial, helvetica, sans-serif; font-size: 10px; }
//-->
</style>
</head>

<body>
Detail have been inserted into the corresponding databases
</body>
</html>
<%
sub dispErr(adbTable)
' if an error is raised then trap it here and end processing
IF err.number <> 0 then
%>

<p>Record already exists on the server and table.</p>
<%
SELECT CASE adbTable
case "imprezanocall" %>
<p>Server: Impreza, Database: AMcat, Table: MasterDonotcall; Was not
updated</p>
<% case "DomConNoCall" %>
<p>Server: Dom_Call, Database: AMcat, Table: MasterDonotcall; Was not
updated</p>
<% case "imprezaTouchstar" %>
<p>Server: Impreza, Database: Touchstar, Table: Dial; Was not
updated</p>
<% case "imprezaTouchstarNC" %>
<p>Server: Impreza, Database: Touchstar, Table: Nevercall; Was not
updated</p>
<% case "connTouchstar" %>
<p>Connection to Touchstar failed</p>
<% END SELECT
end if
Err.Clear

end sub
%>

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
2
by: Lampa Dario | last post by:
Hi, where is this stupid error in this program? When I execute it, i receive a segmentation fault error. #include <stdio.h> int main(int argc, char *argv, char *env) { int i=0; int l=0; int...
4
by: Robert Schuldenfrei | last post by:
Dear NG, I was about to "improve" concurrency checking with a Timestamp when I discovered that my current code is not working. After about a day of beating my head against the wall, I am...
1
by: Greg Burns | last post by:
I am trying to write a global custom error page. I thought I would jot down some of what I've learned so far... At first I just used the default customErrors section with a defaultRedirect tag,...
2
by: Keith Bottner | last post by:
I just reinstalled my system and am in the process of getting PostgreSQL up and running again. During compilation of Postgres I received the following error: .... checking for main in...
7
by: Charlie Brookhart | last post by:
I have a program (posted below) that is supposed to take liters, which is the user input, and convert it to pints and gallons. The pints and gallons are displayed in a read only textbox. I don't...
10
by: JLuis Estrada | last post by:
Hi there Its my 1st post in this group and I hope we could have a great time. well, this is my problem I was debbuging my app (a website) and the system get stuck and I had to reboot the...
11
by: Bryan Crouse | last post by:
I am looking a way to do error checking on a string at compile time, and if the string isn't the correct length have then have the compiler throw an error. I am working an embedded software that...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.