Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > ADO Data > ADO returns emp...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 4245 of 4320
Post > Topic >>

ADO returns empty recordset s****adically under Interop scenarios

by Josh Gough <jsgough@[EMAIL PROTECTED] > Jun 10, 2008 at 08:09 PM

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 );
      }
 




 2 Posts in Topic:
ADO returns empty recordset sporadically under Interop scenarios
Josh Gough <jsgough@[E  2008-06-10 20:09:13 
Re: ADO returns empty recordset sporadically under Interop scena
"Bob Barrows [MVP]&q  2008-06-11 06:49:03 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 14:19:23 CST 2008.