mfc >> ODBC Invalid Descriptor Index???

by Clive Minnican » Tue, 25 Nov 2003 04:49:17 GMT

Hello,

I am written an application which connects to an Access database using ODBC.
The application creates and opens a CDatabase object and then opens
CRecordset derived objects for each table in the database. This appears to
be working just fine on my machine but for some strange reason on my
colleagues machine "INVALID DESCRIPTOR INDEX" errors are produced when
trying to add to one of the recordsets!

Any ideas about why this happens and how to fix it?

Cheers,
Clive.





mfc >> ODBC Invalid Descriptor Index???

by Roy Fine » Tue, 25 Nov 2003 09:12:58 GMT


Clive

I saw this after an upgrade to MDAC 2.8 - it was caused by an field ordering
problem when using the CRecordset::GetFieldValue method - especially when I
was not fetching all of the columns, and fetching then in a different order
than was specified in the Select statement.

The application worked find with MDAC 2.6, and quit when the MDAC upgrade
was installed. It turns out that the fetch out of sequence approach is not
documented to work (as opposed to being documented as not working!!!).

See if this link helps:

http://msdn.microsoft.com/library/en-us/odbc/htm/odch21epr_3.asp

regards
roy fine





ODBC.





mfc >> ODBC Invalid Descriptor Index???

by Roy Fine » Tue, 25 Nov 2003 09:26:07 GMT

Clive,

I think this is the reference I was looking for:

http://msdn.microsoft.com/library/en-us/odbc/htm/odch21gpr.asp

specifically this note:
" the number of the column specified in the current call was less than the
number of the column specified in the preceding call;"


regards
roy fine



ordering
I
order
not


to




Similar Threads

1. Design question: Indexing Large Dataset / Global Descriptor

Hi there,

  Just a quick question, what are good references on some kind of
'global descriptor' that would abstract the notion of pointer when
accessing a large dataset ? I need to be able to index all entity in a
potential very large dataset where entity would reside in different
address space.

Thanks for pointers,
-Mathieu

2. ODBC SQL Server: Invalid attribute/option identifier

3. Microsoft.Data.Odbc vs System.Data.odbc

System.Data.Odbc namespace is only available in .NET framework 1.1 while
Microsoft.Data.Odbc is available in .NET framework 1.0.  I heard that the
System.Data.Odbc is exact the same as Microsoft.Data.Odbc except some bug
fixes.  But I am not sure.  Could someone help me confirm that or correct
me?  I have some old code using Microsoft.Data.Odbc and I would like to
replace it with the new System.Data.Odbc.  Can I just do the string
replacement?

Thanks,

Andy


4. MSAccess Problem solved (was Simultaneous access: Perl (DBD::ODBC) and C# (ODBC)) - Perl

5. Simultaneous access: Perl (DBD::ODBC) and C# (ODBC)

I'm using perl on a windows machine.

I have a perl batch process populating an MSAccess database and a ASPX C#
front end reading from the (same) MSAccess database. The ASPX/C# works fine
as long as there is not a perl program trying to populate the database. If
there is a perl program populating the database, then the ASPX/C# dies with
a "could not lock file" error or " Could not use ''; file already in use."
Depending on whether the C# is using OLEDB or ODBC.

I've been posting in the ADO and MSAccess forums for help but they seem to
be stumpted.

I tried to reproduce the problem by copying the massive SQL SELECT statement
out of the C# code and pasting it into a little perl test program. The perl
runs fine!

Here is my select statement that I use in all the perl programs (readers and
writers):
my $dbh = DBI->connect("dbi:ODBC:driver={Microsoft Access Driver
(*.mdb)};dbq=c:\\Inetpub\\heintze\\keyword-job-search\\$sDatabase","Admin","
") or die "$DBI::errstr\\n";

Is there anything in this connect statement that might exclude other
readers?

Here is the connection statement I am using in C# that is causing the
errors:

Driver={Microsoft Access Driver
(*.mdb)};Dbq=C:\Inetpub\heintze\keyword-job-search\job-search.mdb;Uid=Admin;
Pwd=;

I was using oledb and switched to ODBC since perl is using ODBC. The
symptoms did not seem to change.

Here is the error I get when perl has the file open:

Could not use ''; file already in use.

To summarize: it always works fine with perl reader. It works fine with
C#/ASPX reader and no simultaneous access. It breaks when perl is
INSERTing/SELECTing and C#/ASPX is SELECTing.

I guess this is really a Microsoft ADO problem but I'm out of ideas. I was
hoping that someone might have some ideas here.

Thanks,
Siegfried

6. Is ODBC/MFC-ODBC Unicode capable?

7. DataView index from DataTable index

Is there a way to get a row's DataView index from the underlying DataTable 
index.

Example
DataTable (sorted by key - 1st column)   DataView (sorted by second column)
Row 0 - A, 2                                         Row 0 - B, 1
Row 1 - B, 1                                         Row 1 - A, 2
Row 2 - C, 2                                         Row 2 - C, 2

I know the key of the row I want and can get the index of that row in the 
DataTable by using the dt.Sort = keyColumnName and idx = 
dt.Find(keyColumnValue).  I'd like to map this to the correct index of this 
row in the DataView or be able to get the index directly from the DataView 
while leaving the Sort property of the DataView alone.

8. can you index a property and then assigned those indexes a sub-property - CSharp/C#