GetOrdinal system.IndexOutOfRangeException

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using the following against a sql database, I get a
system.IndexOutOfRangeException for the column name Add_Date which is valid
field name and is a datetime field. All the other columns work ok. Does
anybody have any ideas. I'm new with .Net and this is driving me crazy.
Dim intTblAddDate As Integer = myReader.GetOrdinal("Add_Date")

Thanks in advance... Dick Bellnier
 
Hello Dick,

I bet you $50 dollars or £ that the problem is that the select query does
not return this field. This is exactly what happens when you try and find an
ordinal which does not exist. I have replicated this problem.

Regards - OHM
 
You are correct. I've obmitted column names before in select statements
with VB6, but I thing this IndexOutOfRangeException message thru me a curve.
Thanks for the help...
 
Back
Top