softmafia
Posts: 44
|
| Posted: 01/25/2005, 5:35 AM |
|
I am designing a little application that pulls out customer record from a database
and the login fields are bothe integer
as in number anytime you try to log in it gives me this error
Error Type:
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.
/banking/Common.asp, line 1472
why is this happening?
below is the line 1472
code
Set Connection = New clsDBbank
Connection.Open
SQL = "SELECT customer_id, security_level FROM Accounts WHERE account_number='" & Replace(Login, "'", "''") & "' AND account_pin='" & Replace(Password, "'", "''") & "'"
Set RecordSet = Connection.Execute(SQL)
line 1472 Result = NOT RecordSet.EOF
If Result Then
Session("UserID") = RecordSet("customer_id")
Session("UserLogin") = Login
Session("GroupID") = RecordSet("security_level")
_________________
softmafia |
 |
 |
Nicole
Posts: 586
|
| Posted: 01/25/2005, 6:10 AM |
|
Hello,
Please try to use CCopenRS function instead:
Dim rs
...
CCopenRS rs, SQL, Connection.Connection, true
This is the function from Common.asp
_________________
Regards,
Nicole |
 |
 |
softmafia
Posts: 44
|
| Posted: 01/25/2005, 9:27 AM |
|
Am not too good in ASP am, a newbie can you please explain how in details so i will know where to input the code please
_________________
softmafia |
 |
 |
peterr
Posts: 5971
|
| Posted: 01/25/2005, 5:00 PM |
|
Looks like the query wasn't executed at all and returned an error. You may want to print the error message as shown at http://docs.codecharge.com/studio/html/ProgrammingTechn...eCustomSQL.html
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Benjamin Krajmalnik
|
| Posted: 01/25/2005, 6:46 PM |
|
ANother method which I use (assuming SQL Server is being used and you have
Enterprise Manager) is to run the profiler so I can see the actual SQL
statement being sent to the back end,
Another option is for you to modify the code as follows:
<code>
SQL = "SELECT customer_id, security_level FROM Accounts WHERE
account_number='" & Replace(Login, "'", "''") & "' AND account_pin='" &
Replace(Password, "'", "''") & "'"
'new line of code follows
Response.Write SQL
Set RecordSet = Connection.Execute(SQL)
</code>
This will now display your query string on your page so you can see the
actual SQL statement.
Now, using any of the tools available to query the backend, try the query
and see if it gives you a meaningful error.
YOu are probably issuing an invalid SQL query to the backend, so it is not
being processed and as a result you are not getting a recordset back.
|
|
|
 |
Nicole
Posts: 586
|
| Posted: 01/26/2005, 2:34 AM |
|
Hello,
In common you can try this code
Set Connection = New clsDBbank
Connection.Open
SQL = "SELECT customer_id, security_level FROM Accounts WHERE account_number='" & Replace(Login, "'", "''") & "' AND account_pin='" & Replace(Password, "'", "''") & "'"
Dim rs,
CCopenRS rs, SQL, Connection.Connection, true
if not rs.EOF then
Session("UserID") =CCGetValue(rs, "customer_id")
Session("UserLogin") = Login
Session("GroupID") = CCGetValue(rs, "security_level")
end if
_________________
Regards,
Nicole |
 |
 |
|