Jeff Johnson

Jeff Johnson

  • NA
  • 23
  • 0

Direct lookup of field?

Dec 10 2008 11:54 PM

I'm using the OdbcDataReader object.  If I'm querying a table called VOUCHER that has VENDOR_ID as the 4th colum which I could find out using

String fName = DbReader.GetName(i);

in a loop to find out the column number and then pull the data down with

_VendorID = DBReader.GetString(i) once I figure out that VENDOOR_ID is in column i,

Would there be a way to say somthing like

_VendorID = DBReader.GetString("VENDOR_ID") and have the class resolve the column name directly, or do I need to write a routine to do it?  Seems like VBA does this with ADO, but this doesn't work they way I have tried to implement it.

Thanks.

Jeff


Answers (3)

1
Bechir Bejaoui

Bechir Bejaoui

  • 0
  • 16.4k
  • 7.1m
Dec 11 2008 6:15 PM

That's ok
1
Jeff Johnson

Jeff Johnson

  • 0
  • 23
  • 0
Dec 11 2008 8:34 AM
Ah, I see.  Thanks.
1
Bechir Bejaoui

Bechir Bejaoui

  • 0
  • 16.4k
  • 7.1m
Dec 11 2008 7:12 AM

Not like that you have to use

dReader["columnname"].ToString();
or
dReader[columnindex].ToString();