views:

46

answers:

1

Why MS Access adodb in .NET returns 34 in fieldcount when table has 42 fields ? I see 42 fields in table of my MS Access mdb database. But ADODB layer in .NET sees only 34 fields. The Outofrange exception occures when I am calling method getOrdinal("FieldName") of reader class.

Is it something I am missing in setting up connection, license or anything?

Thank you

+1  A: 

Have you changed the table since you wrote the code? Sometimes you have to relink the tables inside Access, or it won't see the new columns.

MJB
Found it. Thank you. The cause was mismatch between the code and database.
RocketSurgeon
While it's the case that an Access front end linked by ODBC to a different database can have exactly the symptoms described (i.e., until you delete and recreate the links, structural changes to the source tables don't show), the question states on the front end "MS Access adodb in .NET", so it's not really a relevant point.
David-W-Fenton
I saw that, and I didn't know how the Access-ODBC link problem could cause it, but I figured it might be worth a try. At least it might have started OP looking in right direction.
MJB
As I said, access is buggy ;-))
Quandary
No, Access is not buggy, but ODBC is OLD.
David-W-Fenton