ekendricks
Posts: 34
|
| Posted: 08/14/2005, 7:05 PM |
|
Using Ms Access 2k - CCS - ASP
I have the following stmt which gives the following error:
Set Connection = New clsDBMed
Connection.Open
SQL = "SELECT LoginID FROM ezUser WHERE EmployeeID = '"&(session("UserID"))&"'"
Set RecordSet = Connection.Execute(SQL)
Result = NOT RecordSet.EOF
If Result Then
LoginID = CStr(RecordSet("LoginID").Value)
Error:
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.
I have created a label, and set its .value = session("UserID"), and thus confirms that UserID is a valid session variable. the stmt works if I set a static value.
Thanks
Ernest
|
 |
 |
peterr
Posts: 5971
|
| Posted: 08/15/2005, 12:10 AM |
|
Do you mean that such SQL works without problems for you?
SELECT LoginID FROM ezUser WHERE EmployeeID = '1'
?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Ernest
|
| Posted: 08/15/2005, 5:15 AM |
|
If I set a static value. ie:SELECT LoginID FROM ezUser WHERE EmployeeID = '1' the sql works. If I use the session variable, which is what I need ie: WHERE EmployeeID = '"&(session("UserID"))&"'"
I get an error. Is there something wrong with the syntax of the where clause?
Ernest
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 08/15/2005, 10:19 AM |
|
Looks like you will need to do some debugging, or at least add error handling.
1. Try adding response.write(SQL) after the SQL = ... statement.
2. See http://docs.codecharge.com/studio/html/ProgrammingTechn...eCustomSQL.html how to implement error handling, then display ErrorMessage.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
DonB
|
| Posted: 08/16/2005, 6:17 AM |
|
A couple of points to consider:
1. It looks like you could simply execute: LoginID = CCGetUserLogin()
2. If not, then perhaps try LoginID =
CCDLookUp("LoginID","ezUser","EmployeeID = " & CCGetUserID(), Connection)
You can often 'borrow' the connection of a grid or record form, rather than
creating a new one on the fly. This saves resources on the server and gives
a bit of performance improvement, although small.
CCS puts a wrapper around the session("UserID") and session("UserLogin")
values which insulates your code from the underpinnings (meaning it should
still work if you change the security configuration, or reuse this code in
another application).
You might need to qualify the Label control as <formname>.Label in your
code. I assume that it works as you defined it and so I followed your
example to write mine.
--
DonB
http://www.gotodon.com/ccbth
"ekendricks" <ekendricks@forum.codecharge> wrote in message
news:642fff852092af@news.codecharge.com...
> Using Ms Access 2k - CCS - ASP
>
> I have the following stmt which gives the following error:
>
> Set Connection = New clsDBMed
> Connection.Open
> SQL = "SELECT LoginID FROM ezUser WHERE EmployeeID =
> '"&(session("UserID"))&"'"
> Set RecordSet = Connection.Execute(SQL)
> Result = NOT RecordSet.EOF
> If Result Then
> LoginID = CStr(RecordSet("LoginID").Value)
>
> Error:
> ADODB.Recordset (0x800A0E78)
> Operation is not allowed when the object is closed.
>
> I have created a label, and set its .value = session("UserID"), and thus
> confirms that UserID is a valid session variable. the stmt works if I
set a
> static value.
>
> Thanks
>
> Ernest
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
Ernest
|
| Posted: 08/16/2005, 10:18 AM |
|
The CCDLookup seems to have done the trick.
Ernest
|
|
|
 |
ADODB.Recordset (0x800A0E78)
|
| Posted: 10/28/2005, 1:50 AM |
|
  
|
|
|
 |
ADODB.Recordset (0x800A0E78)
|
| Posted: 10/28/2005, 1:51 AM |
|
                                 
|
|
|
 |