Case Sensitivity of field names

Posts   
 
    
wiredeye
User
Posts: 18
Joined: 15-Jul-2008
# Posted on: 18-Nov-2008 16:20:29   

Is there a way around case sensitivity of field names. I am iterating through user list to find field value:

Dim bkmValue as object Dim bkmField as string Dim Contact as new ContactEntity(id)

bkmValue = Contact.Fields(bkmField).CurrentValue

If bkmField is cased exactly as the generated LLBLGen Pro Field name all is well. ie "MCity" works but "Mcity" does not.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 18-Nov-2008 22:06:22   

I don't think so, but I'll check further for you.

Just out of interest, how do you get to a position of knowing the field names, but not their casing in the first place ?

Matt

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 19-Nov-2008 08:06:35   

Added to what Matt said: you can use Enum parse method to ignore the case sensitive:

string fieldName = "mcity";

ContactFieldIndex MCityFieldIndex = (ContactFieldIndex) Enum.Parse(typeof(ContactFieldIndex), fieldName, true);
bkmValue = theContact.Fields[(int) MCityFieldIndex].CurrentValue;
David Elizondo | LLBLGen Support Team
wiredeye
User
Posts: 18
Joined: 15-Jul-2008
# Posted on: 19-Nov-2008 17:05:50   

To Matt: The code is replacing bookmarks in word. Another part of the app reads a table of bookmarks and inserts them: That table is the issue. Developer could see the SQL field names but not the Generated Code. In short - you're right. Changing the table names to reflect the code is what has to be done.

To David. Thank you. That gets me over hump. Way over my head but I got it!

Thanks to you as always.