Menu

#2 invalid type cast in MySQLDataReader.cs

closed
nobody
None
5
2003-01-29
2002-12-29
No

When trying to use the data reader i.e. like this:
string myString = myReader[ColumnName].ToString()
where ColumName is a string containing the column
name I get a type casting error.

I was able to make it work by changing line 276 in
MySQLDataReader.cs from

public int GetOrdinal(string strColName) { return
(int) m_objFieldNames[strColName]; }

to

public int GetOrdinal(string strColName) { return
Convert.ToInt32(m_objFieldNames[strColName]); }.

Discussion

  • Christoph Wienands

    Logged In: YES
    user_id=628447

    Hi Matthias,

    thanks, I will take care of it.

    Christoph

     
  • Christoph Wienands

    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB