• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

vb.net 2005 reflection question

Mercypoint

Weaksauce
Joined
Oct 22, 2005
Messages
74
Hi,
I'm trying to "force feed" my class from the database. I have a class with properties that is exactly named as a table column names expect for in the class, it is camel cased and in the database, it is all caps.
My problem is that I can't get the Bindingflags.IgnoreCase to work for me.

Code:
Dim propInfo as PropertyInfo
Dim columnName as String
For i as Integer = 0 To datatable.columns.Count -1
  columnName = datatable.columns.item(i).columnName
  propInfo = oType.GetProperty(columnName, BindingFlags.IgnoreCase)

propInfo will always return a Nothing because the case do not match. Am I missing something?

Thanks
 
When you specify BindingFlags, you need to specify the default BindingFlags as well. Something like this would be what you'd need

Code:
oType.GetProperty(columnName, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty);

Note, that's c# syntax above, I'm not sure what the bitwise or operator is in VB.NET.
 
Back
Top