473,320 Members | 1,799 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,320 software developers and data experts.

How do correct the exception occurred?

Hi!

I got error. Pls check my error.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. dim uname
  3. dim pwd
  4.  
  5. uname = Request.Form("txtuname")
  6. pwd = Request.Form("txtpwd")
  7. Session.Contents("uname") = uname
  8.  
  9. Set rs = Server.CreateObject("ADODB.Recordset")
  10. Set rs.ActiveConnection = my_Conn
  11. rs.Open "select * from tbl_Login_info where User_name = '"&uname&"' "
  12.  
  13. if rs.RecordCount = 0 then
  14.     rs.Close
  15.     my_Conn.Close
  16.     set rs=nothing
  17.     set my_Conn=nothing
  18.     Response.Redirect("verify.asp?Submit=namefailed")
  19. end if
  20.  
  21. if rs("User_name") = uname  then // [b] i got error in this line "Exception occurred? [b]
  22.     if rs("Password")= pwd then
  23.     rs.Close
  24.     my_Conn.Close
  25.     set rs=nothing
  26.     set my_Conn=nothing
  27.     Response.Redirect("wel.html")
  28.     else
  29.     rs.Close
  30.     my_Conn.Close
  31.     set rs=nothing
  32.     set my_Conn=nothing
  33.     Response.Redirect("verify.asp?Submit=passfailed")
  34.     end if
  35. else
  36.     rs.Close
  37.     my_Conn.Close
  38.     set rs=nothing
  39.     set my_Conn=nothing
  40.     Response.Redirect("verify.asp?Submit=namefailed")
  41. end if
  42.  
  43. %>
  44.  
  45.  
Mar 17 '10 #1

✓ answered by Soniad

Hi,

In VbScript we use " ' " to comment code. "//" is used in JavaScript.
And Avoid writing same code multiple times if it can be written once.
When you fetch the record, always check EOF or BOF.

Try the following and reply whether it works :

Expand|Select|Wrap|Line Numbers
  1. <% 
  2. dim uname 
  3. dim pwd,StrRedirect 
  4.  
  5. StrRedirect = "verify.asp?Submit=namefailed"     ' Default Redirect
  6.  
  7. uname = Trim(Request.Form("txtuname"))
  8. pwd = Trim(Request.Form("txtpwd")) 
  9. Session.Contents("uname") = uname 
  10.  
  11. Set rs = Server.CreateObject("ADODB.Recordset") 
  12. Set rs.ActiveConnection = my_Conn 
  13. rs.Open "select * from tbl_Login_info where User_name = '"&uname&"' " 
  14.  
  15.  
  16. If Not rs.EOF Then
  17.     If rs("User_name") = uname  Then ' [b] i got error in this line "Exception occurred? [b] 
  18.         If rs("Password")= pwd Then 
  19.         StrRedirect = "wel.html"
  20.         Else 
  21.         StrRedirect = "verify.asp?Submit=passfailed"    
  22.         End If
  23.     End If    
  24. End If 
  25.  
  26.  
  27.     If rs.State = 1 Then rs.Close
  28.     Set rs=Nothing 
  29.     Set my_Conn=Nothing  
  30.  
  31.     Response.Redirect(StrRedirect) 
  32. %> 
  33.  
  34.  
  35.  
Regards,

"D"

2 1653
Soniad
66
Hi,

In VbScript we use " ' " to comment code. "//" is used in JavaScript.
And Avoid writing same code multiple times if it can be written once.
When you fetch the record, always check EOF or BOF.

Try the following and reply whether it works :

Expand|Select|Wrap|Line Numbers
  1. <% 
  2. dim uname 
  3. dim pwd,StrRedirect 
  4.  
  5. StrRedirect = "verify.asp?Submit=namefailed"     ' Default Redirect
  6.  
  7. uname = Trim(Request.Form("txtuname"))
  8. pwd = Trim(Request.Form("txtpwd")) 
  9. Session.Contents("uname") = uname 
  10.  
  11. Set rs = Server.CreateObject("ADODB.Recordset") 
  12. Set rs.ActiveConnection = my_Conn 
  13. rs.Open "select * from tbl_Login_info where User_name = '"&uname&"' " 
  14.  
  15.  
  16. If Not rs.EOF Then
  17.     If rs("User_name") = uname  Then ' [b] i got error in this line "Exception occurred? [b] 
  18.         If rs("Password")= pwd Then 
  19.         StrRedirect = "wel.html"
  20.         Else 
  21.         StrRedirect = "verify.asp?Submit=passfailed"    
  22.         End If
  23.     End If    
  24. End If 
  25.  
  26.  
  27.     If rs.State = 1 Then rs.Close
  28.     Set rs=Nothing 
  29.     Set my_Conn=Nothing  
  30.  
  31.     Response.Redirect(StrRedirect) 
  32. %> 
  33.  
  34.  
  35.  
Regards,

"D"
Mar 18 '10 #2
Hi,

Thank you soo much
Mar 19 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Professor Frink | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms...
0
by: lianfe_ravago | last post by:
Input string was not in a correct format. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the...
5
by: blackg | last post by:
Input string not in correct format -------------------------------------------------------------------------------- I am trying to view a picture from a table. I am getting this error Input string...
5
by: Lars-Erik Aabech | last post by:
Hi! Guess it's my day again.. Tried to deploy a test release of a new asp.net web today, and got a terrible error. The web is running swell on three development computers, but when it's copied...
4
by: Craig831 | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms...
7
by: Alan Pretre | last post by:
I have an application installed at a customer site that has been getting a general network error for a couple of years. I was hoping that .NET 2.0 would clear it up, but unfortunately it didn't. ...
0
by: mike.varley1 | last post by:
Hi All We are getting the warning messages below several times a day in the app event logs on our Win2k3 server. Can anyone shed any light on the meaning\cause of the DC issue, especially: "This...
0
by: sehguh | last post by:
Hiya Folks, I am Currently using windows xp. Also using Visual Web Developer 2005 and Microsoft Sql server 2005. The main page consists of an aspx page and a master page. The page also...
1
by: sehguh | last post by:
Hello folks I have recently been studying a book called "sams teach yourself asp.net 2.0 in24 hours by scott mitchell. I have reached page 614 but when i tried to run an asp page called...
1
by: differentsri | last post by:
THIS IS AN ASP.NET 1.1 APPLICATION IAM TRYING TO UPDATE THE FIELD BUT I AM NOT ABLE TO UPDATE IT? CAN U TELL THE REASON ? IT IS GIVING THE FOLLOWING ERROR BELOW I HAVE ALSO GIVEN THE CODE OF...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.