Hello everyone,

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.

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() )
      {
         m_objAdo.Close();
         m_objAdo.Disconnect();

         // Could not find the User Name or Email in the database
          strErr.Format( CResString(IDS_ERR_USERNAMENOTFOUND), strUserName );
       }

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to