S
Steven Scaife
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
%>
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
%>