Hello,
I'm having a problem that actually is inside of a COM class with ADO
that is used inside of interop scenarios from C#.
I'm not sure if this is actually .NET specific or just a problem with
the
underlying COM / ADO code, but it seems to only happen under interop.
It is very very similar to this
http://sup****t.microsoft.com/default.aspx/kb/230101.
However, we are running MDAC 2.8 and on Windows 2003, IIS 6.
There was one person on experts-exchange.com who had a similar problem
under 2003 and II6. Someone told him to use IIS 5 Isolation Mode, but
it wasn't clear if that solved the issue.
A colleague said that he thinks .NET maps requests for ADO in legacy
COM objects to ADO.NET behind the scenes, but I don't think that's
true. They are different technologies. Anyone know for certain?
Scenario:
1. We have an ASP.NET system that is using COM Interop. The COM
library has
a Login method which attempts to authenticate the user against a
database
table. Normally this works fine.
2. However, once in a while, the eof condition gets triggerred in the
offending code below. This should not be getting triggered because the
strUserName value that is passed in IS in the database.
We have verified that it is not a database problem because we have an
exception handler in the .NET code which attempts to execute the
identical
SQL statement except that it uses Enterprise Library to do so. It
finds the
user just fine.
What is odd about this is that there is not a failure of the
m_objAdo.Open
statement. Rather, it simply appears that the result-set is coming
back empty.
Could there be some kind of strange memory problem or connection pool
problem that would result in this kind of behavior. I would expect
there to
be an explicit error rather than an empty result set.
Any ideas much appreciated.
Thank you,
Josh
Offending code:
strSql.Format( _T("SELECT TOP 1 * FROM %s WHERE %s = %s OR %s = %s
ORDER BY
Len(%s) DESC"),
_mt(TABLE_USERS),
FIELD_EMAILADDRESS, (LPCTSTR)
SqlString(strUserName),
FIELD_REALEMAILADDRESS, (LPCTSTR)
SqlString(strUserName),
FIELD_REALEMAILADDRESS );
}
ComThrowOle( m_objAdo.Connect( pAS ) );
ComThrowOle( m_objAdo.Open( strSql, adOpenKeyset,
adLockOptimistic ) );
if ( m_objAdo.eof() ) // --> This is what s****adically returns
empty
{
m_objAdo.Close();
m_objAdo.Disconnect();
// Could not find the User Name or Email in the database
strErr.Format( CResString(IDS_ERR_USERNAMENOT
FOUND), strUserName );
}


|