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><f ont class='error'>E rror: Username is
unavailable</font></center><br><br> "
Response.Write "<center><f ont class='error'>" & Err.number & ":" &
Err.Description & "</font></center><br>"
By right only the statement bellow is suppose to get executed:
Response.Write "<center><f ont class='error'>" & Err.number & ":" &
Err.Description & "</font></center><br>"
How do I solve the problem:
Complete code:
on error resume next
set conn = Server.CreateOb ject("ADODB.Con nection")
conn.open "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" &
Server.MapPath( "/db/upload/stelladb.md") & ";"
set rs = Server.CreateOb ject("ADODB.Rec ordset")
conn.qDupUser p1,rs
If not rs.eof then
If rs(0) = 1 then
response.write "<center><f ont class='error'>E rror: Username is
unavailable</font></center><br><br> "
session("duplic ate") = "true"
else
session("duplic ate") = "false"
end if
Else
response.write "<center><f ont class='error'>E rror: No records
returned</font></center><br><br> "
End if
If Err.number <> 0 then
Response.Write "<center><f ont class='error'>" & Err.number & ":" &
Err.Description & "</font></center><br>"
Else
conn.close
set conn = nothing
if session("duplic ate") = "false" then
InsertQueryStri ng p1,p2,p3
end if
End if
on Error goto 0
Sub InsertQueryStri ng(p1,p2,p3)
arParms = Array(p1,p2,p3)
sql = "INSERT INTO Account([Username],[Password],[Type]) VALUES(?,?,?)"
RunQueryString sql, arParms
End Sub 3 1425
solomon_13000 wrote: 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,
So stella.mdb is an actual database, so your conn.open statement does not
throw an error?
Change the code as shown below:
what happens is the following statement gets executed:
response.write "<center><f ont class='error'>E rror: Username is unavailable</font></center><br><br> "
Response.Write "<center><f ont class='error'>" & Err.number & ":" & Err.Description & "</font></center><br>"
By right only the statement bellow is suppose to get executed:
Response.Write "<center><f ont class='error'>" & Err.number & ":" & Err.Description & "</font></center><br>"
How do I solve the problem:
Complete code:
on error resume next set conn = Server.CreateOb ject("ADODB.Con nection") conn.open "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & Server.MapPath( "/db/upload/stelladb.md") & ";"
if err<>0 then response.write "<center><f ont class='error'>E rror: Username is unavailable</font></center><br><br> " session("duplic ate") = "true"
else set rs = Server.CreateOb ject("ADODB.Rec ordset") conn.qDupUser p1,rs If not rs.eof then If rs(0) = 1 then response.write "<center><f ont class='error'>E rror: Username is unavailable</font></center><br><br> " session("duplic ate") = "true" else session("duplic ate") = "false" end if Else response.write "<center><f ont class='error'>E rror: No records returned</font></center><br><br> " End if If Err.number <> 0 then Response.Write "<center><f ont class='error'>" & Err.number & ":" & Err.Description & "</font></center><br>" Else conn.close set conn = nothing if session("duplic ate") = "false" then InsertQueryStri ng p1,p2,p3 end if End if
End if
on Error goto 0
Sub InsertQueryStri ng(p1,p2,p3) arParms = Array(p1,p2,p3) sql = "INSERT INTO Account([Username],[Password],[Type]) VALUES(?,?,?)"
RunQueryString sql, arParms End Sub
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
valid database name:stelladb.m db
invalid database name: stella.mdb
It does throw an error message using an invalid db name:
Response.Write "<center><f ont class='error'>" & Err.number & ":" &
Err.Description & "</font></center><br>"
but the code also displays the following error msg which is not suppose
to be displayed:
response.write "<center><f ont class='error'>E rror: Username is
unavailable</font></center><br><br> "
solomon_13000 wrote: 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><f ont class='error'>E rror: Username is unavailable</font></center><br><br> "
Response.Write "<center><f ont class='error'>" & Err.number & ":" & Err.Description & "</font></center><br>"
By right only the statement bellow is suppose to get executed:
Response.Write "<center><f ont class='error'>" & Err.number & ":" & Err.Description & "</font></center><br>"
How do I solve the problem:
Complete code:
on error resume next set conn = Server.CreateOb ject("ADODB.Con nection") conn.open "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & Server.MapPath( "/db/upload/stelladb.md") & ";" set rs = Server.CreateOb ject("ADODB.Rec ordset") conn.qDupUser p1,rs If not rs.eof then If rs(0) = 1 then response.write "<center><f ont class='error'>E rror: Username is unavailable</font></center><br><br> " session("duplic ate") = "true" else session("duplic ate") = "false" end if Else response.write "<center><f ont class='error'>E rror: No records returned</font></center><br><br> " End if If Err.number <> 0 then Response.Write "<center><f ont class='error'>" & Err.number & ":" & Err.Description & "</font></center><br>" Else conn.close set conn = nothing if session("duplic ate") = "false" then InsertQueryStri ng p1,p2,p3 end if End if on Error goto 0
Sub InsertQueryStri ng(p1,p2,p3) arParms = Array(p1,p2,p3) sql = "INSERT INTO Account([Username],[Password],[Type]) VALUES(?,?,?)"
RunQueryString sql, arParms End Sub
solomon_13000 wrote: valid database name:stelladb.m db invalid database name: stella.mdb
It does throw an error message using an invalid db name:
Response.Write "<center><f ont class='error'>" & Err.number & ":" & Err.Description & "</font></center><br>"
but the code also displays the following error msg which is not suppose to be displayed:
response.write "<center><f ont class='error'>E rror: Username is unavailable</font></center><br><br> "
Well change it to display the message you want it to display in the if err
<> 0 then block. (hopefully, you made the changes I suggested - it will be
really helpful if you post your code revisions in any followups to this).
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM" This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jo |
last post by:
Hi,
I have a small (hopefully!) problem. I have two buttons on my web page and when button A is clicked, the code behind takes about 3 seconds to execute. While it's executing though, I don't want the user to be able to click button B. What I have found happens is that if user clicks button B while button A is still executing, the code behind button B will start executing straight after the code under A has finished, and there is no page...
|
by: Default |
last post by:
Hi, I am new to C#, that is why I am not sure what kind of problem it is: Is
VS files corrupted , or something else. that is the problems description:
I am working on a small database project. I am not using any data sources
Mysql, access etc. Instead I use binary formatter to store and read data. at
the beginning the program checks username/password. it does it in the
following way:
if(form2.initialized)
{
for(int i=0;...
|
by: Namratha Shah \(Nasha\) |
last post by:
Hey Guys,
Today we are going to look at Code Access Security.
Code access security is a feature of .NET that manages code depending on its
trust level. If the CLS trusts the code enough to allow it ro run then it
will execute, the code execution depends on the permission provided to the
assembly. If the code is not trusted wnough to run or it attempts to perform
an action which doe not have the required permissions then its execution...
|
by: Adrian Enders |
last post by:
I have something that I have never seen before in a MS development product.
I have a pretty simple call to a network directory that looks something like
this ...
Dim dirFolder As System.IO.DirectoryInfo
dirFolder = New System.IO.DirectoryInfo(sFilePath)
Dim filFiles() As System.IO.FileInfo
|
by: Peter Olcott |
last post by:
Cab you write code directly in the Common Intermediate language? I need to
optimize a critical real-time function.
| |
by: Rea |
last post by:
Hi eb
I set some 'Stop' statements and also visual breakpoints
in asp code (vbscript).
I am doing that in Microsoft Script debugger.
Than I refresh the original page and expect execution to halt
at these breakpoints but unfortunatly it does not..
I had allowed script debugging in both iis home directory and in internet
explorer.
Also i added everyone from active directory to be members of debugging group.
Web Server is W2k sp4 and iis...
|
by: Sabiyur |
last post by:
Hi All,
I don't know whether this is the right forum to post this
question.
If not, Please forgive me.
I want to write my own tool which can trace the code execution (print
the sequence of function execution into a file).
But I cannot change the source code. (i.e.) I cannot write some Trace
macros
into source code.
|
by: poornibalu |
last post by:
I want to stop the execution of the code when the value of k>100 in
the function
function aa()
{
if (k>100)
{
//command to kill the execution
|
by: Andrew Poulos |
last post by:
If I have code that looks like this
ajax = function(str) {
var val = "";
// do some stuff here
return val;
};
var foo = ajax("string");
|
by: sphinney |
last post by:
Hi everyone. I'm creating an application inside Access 2007. The application will retrieve data from various locations on my company's network servers.
Depending on the time of day, alignment of the planets, other unfathomable mysteries sometimes my company's network is very, very slow.
I would like to provide the user of my application with a "Cancel" button on a form that will cancel/stop execution of the code (at whatever point it may...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |