|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
i am getting exception error all of a sudden out of very nicely running code :-(((
the error i get: Error Type: (0x80020009) Exception occurred. /myweb2/loginDB2.asp, line 14 here is my code: <% DIM RSA DIM QUERY1 DIM RSA2 DIM QUERY2 dim stud varTxtName = Request.form("txtNAME") varTxtPass = Request.form("txtPassword") If varTxtNAME <>"" and varTxtPass <> "" and Request("login") = "Login" Then Set RSA = Server.CreateObject("ADODB.Recordset") stud = "0" QUERY1 = "SELECT count(*) as MyCount, student_name from student_info Where student_username='"&varTxtName& "' and student_password ='"&varTxtPass&"' group by student_name" RSA.Open QUERY1, "DSN=school" If RSA.Fields("MyCount") > 0 then >this is line 14 ! ] response.write ("student logged in") server.transfer("welStudent.asp") stud = "1" else stud = "0" end if RSA.Close Set RSA = Nothing Set RSA2 = Server.CreateObject("ADODB.Recordset") QUERY2 = "SELECT count(*) as MyCount2, teacher_name from teacher_info Where teacher_username='"&varTxtName& "' and teacher_password ='"&varTxtPass&"' group by teacher_name" RSA2.Open QUERY2, "DSN=school" If RSA2.Fields("MyCount2") > 0 and stud = "0" then response.write ("teacher logged in!") server.transfer("teacher.asp") else response.write ("a new student") server.transfer("newStudent.asp") end if else Response.write "Please enter Both the Student Id and the Password!!!" server.transfer("loginDB.asp") End If % |
|
#2
|
|||
|
|||
|
Look at my post here...
http://forums.devshed.com/t71549/s.html read the part about making a Response.Write of your SQL Query *BEFORE* you execute it. Then paste the results into your database and *look* at the results. Then try this instead: If Clng(RSA("MyCount")) > 0 Then . . . End If Hope this helps! Sincerely Vlince |
|
#3
|
|||
|
|||
|
hey thanks vlince...somehow i got my problem resolved bu silightly cahnging the code,. WHen i check for the recordest... i know check for eof?? i dont know how but its working.
<% DIM RSA DIM QUERY1 DIM RSA2 DIM QUERY2 dim stud dim MyCount dim varTxtName session("TxtName") = Request.form("txtNAME") varTxtName = session("TxtName") response.write varTxtName varTxtPass = Request.form("txtPassword") If varTxtNAME <>"" and varTxtPass <> "" and Request("login") = "Login" Then Set RSA = Server.CreateObject("ADODB.Recordset") stud = "0" QUERY1 = "SELECT * from student_info Where student_username='"&varTxtName& "' and student_password ='"&varTxtPass&"'" RSA.Open QUERY1, "DSN=school" If not RSA.EOF then response.write ("student logged in") server.transfer("welStudent.asp") stud = "1" else stud = "0" end if RSA.Close Set RSA = Nothing Set RSA2 = Server.CreateObject("ADODB.Recordset") QUERY2 = "SELECT * from teacher_info Where teacher_username='"&varTxtName& "' and teacher_password ='"&varTxtPass&"'" RSA2.Open QUERY2, "DSN=school" If not RSA2.eof and stud = "0" then response.write ("teacher logged in!") server.transfer("teacher.asp") else response.write ("a new student") server.transfer("newStudent.asp") end if else Response.write "Please enter Both the Student Id and the Password!!!" server.transfer("loginDB.asp") End If %> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > stuck up... exception error~ |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|