ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 5th, 2003, 05:52 AM
aspuser25 aspuser25 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 141 aspuser25 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Unhappy stuck up... exception error~

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
%

Reply With Quote
  #2  
Old September 5th, 2003, 07:35 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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

Reply With Quote
  #3  
Old September 7th, 2003, 06:46 AM
aspuser25 aspuser25 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 141 aspuser25 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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
%>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > stuck up... exception error~


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT