-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 04 Jul 2003 11:06 pm, Miguel de Icaza wrote: > Hello, > > > Ok, it definitely looks like Mono being a little naughty but it's a > > simple fix. > > > > The offending code is: > > > > uniqueId = reader.GetInt32(reader.GetOrdinal("RealContentItemId")); > > > > > > and the fix is: > > > > uniqueId = reader.GetOrdinal("RealContentItemId"); > > > > It seems that GetOrdinal is returning an Int32 and we then try to convert > > to a (wait for it) Int32. Mono should just ignore this code but it > > doesn't. Actually, the programming team never should have written it like > > this, but hey, Mono should handle this kind of stupidity. > > Lets examine the problem a bit more, because I was as perplexed as you > were that a conversion from int to int would throw that exception. > > What is happening here is that "reader.GetOrdinal > ("RealContentItemId")" returns an integer.
Correct, an Int32 to be exact IIRC. MSDN has the following definition: public virtual int GetOrdinal( string name ); and the GetInt32 function is: public virtual int GetInt32( int i ); Now that's not what I'd call a useful function to start with...they're going to convert an int to an int??? In any case, it works on MS platform and doesn't for Mono. > And here is the problem: the returned int is used as the ColumnValue > *key* whose value happens to be something different. The returned int is indeed used as a column key. This key is then used to return the actual value of the column...now this is weird. I seem to recall from the tests that the value coming back from GetInt32 was not the actual value that the table held but may have been the column index instead. Now I'll have to go write that code again and find out, because looking at the MSDN reveals that the GetInt32 should have return the contents of the field, not the column ID. I'll keep you informed... > Am not a System.Data expert, but this is either a bug on the original > runtime, or there is a miss-conception in the > System.Data.SqlClient.GetValue code. > > I added some extra information to the exception on CVS > > Miguel -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iQIVAwUBPwYFlPr1e7bH1pzBAQJHqQ/7BwKT1x9DzSRlqBDvOiEhXpO6L/mjV/fQ +3ilMUS0cPUA4R7ypfJlSo9mpsJK05BAWvNxLtF2ywWoSYW1SgmV6zaxMM/dgBs2 4JrEWdOLjWbIM3TmwJvmAyY8LZMvUf67jLBNjpgZTCMCpH2Yv5EViMSx4vRat9AY Na7BMET8Hk9F8SWVJ3M39+f5UKGOUWTb1kLb+QFFPS8MnX5RwM3i3eIbXXQck0in KixrYjxvRKrhplSvzbgltHXX85/ohKQH8NIxmujZAKwiYuWB2NVloTWtHSAaKabR 6FVQABbqatlKTg31QLmr/vEGmPLK7NUbXgO31e+hWYUgfXP07KZd+WgKp1eredEy M4hSkHiM06auwR9pJ0YkUGofwFk0mGQ0QQgzzvvetvIiJYI83MzKysybRhP4qJyK SpckcujX02u1Q3SBoj3OSttVuoGeKe5JhUjFuC9vHameKwDDwvJpGMXgW1Emt5ig ecNGzuhlm6eXgLUf3pnWNkJ50knn1QEimTPQcdPP5CcBSEfgFjTFf8FSzbO5ycCz +Xqy+XV2beZfa4ALzHWV8oxY+/KqT3UdDk72h448Zwca0LgILROSL2czMeGX+/6J O/j8FHxHraG7P84GN7G6lOeOo/O7F4W2egJX99LXmL364IiKu6mzSX1znmXyVljI ML/M3pI5Osw= =rtmy -----END PGP SIGNATURE----- _______________________________________________ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list