S
solomon_13000
The problem with the code bellow is that suppose I change the valid
database name from stelladb.mdb to an invalid database name stella.mdb,
what happens is the following statement gets executed:
response.write "<center><font class='error'>Error: Username is
unavailable</font></center><br><br>"
Response.Write "<center><font class='error'>" & Err.number & ":" &
Err.Description & "</font></center><br>"
By right only the statement bellow is suppose to get executed:
Response.Write "<center><font class='error'>" & Err.number & ":" &
Err.Description & "</font></center><br>"
How do I solve the problem:
Complete code:
on error resume next
set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/db/upload/stelladb.md") & ";"
set rs = Server.CreateObject("ADODB.Recordset")
conn.qDupUser p1,rs
If not rs.eof then
If rs(0) = 1 then
response.write "<center><font class='error'>Error: Username is
unavailable</font></center><br><br>"
session("duplicate") = "true"
else
session("duplicate") = "false"
end if
Else
response.write "<center><font class='error'>Error: No records
returned</font></center><br><br>"
End if
If Err.number <> 0 then
Response.Write "<center><font class='error'>" & Err.number & ":" &
Err.Description & "</font></center><br>"
Else
conn.close
set conn = nothing
if session("duplicate") = "false" then
InsertQueryString p1,p2,p3
end if
End if
on Error goto 0
Sub InsertQueryString(p1,p2,p3)
arParms = Array(p1,p2,p3)
sql = "INSERT INTO Account([Username],[Password],[Type]) VALUES(?,?,?)"
RunQueryString sql, arParms
End Sub
database name from stelladb.mdb to an invalid database name stella.mdb,
what happens is the following statement gets executed:
response.write "<center><font class='error'>Error: Username is
unavailable</font></center><br><br>"
Response.Write "<center><font class='error'>" & Err.number & ":" &
Err.Description & "</font></center><br>"
By right only the statement bellow is suppose to get executed:
Response.Write "<center><font class='error'>" & Err.number & ":" &
Err.Description & "</font></center><br>"
How do I solve the problem:
Complete code:
on error resume next
set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/db/upload/stelladb.md") & ";"
set rs = Server.CreateObject("ADODB.Recordset")
conn.qDupUser p1,rs
If not rs.eof then
If rs(0) = 1 then
response.write "<center><font class='error'>Error: Username is
unavailable</font></center><br><br>"
session("duplicate") = "true"
else
session("duplicate") = "false"
end if
Else
response.write "<center><font class='error'>Error: No records
returned</font></center><br><br>"
End if
If Err.number <> 0 then
Response.Write "<center><font class='error'>" & Err.number & ":" &
Err.Description & "</font></center><br>"
Else
conn.close
set conn = nothing
if session("duplicate") = "false" then
InsertQueryString p1,p2,p3
end if
End if
on Error goto 0
Sub InsertQueryString(p1,p2,p3)
arParms = Array(p1,p2,p3)
sql = "INSERT INTO Account([Username],[Password],[Type]) VALUES(?,?,?)"
RunQueryString sql, arParms
End Sub