SQL Server Column Names


Author
Message
Tim Dol
Tim Dol
StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
I am trying to build business objects for a thirdy party database where some of the column names contain a 'space' or a 'hyphen'.



Example: 'E-MailID' or 'Field Name'



The mapper has no problem building the partial class for these fields but I guess these names are invalid in VB.



Any suggestions on how to get around these issues and still be able to manage the database. I can't change the field names - it's not my database.



Thanks,

Tim

Peter Jones
Peter Jones
Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi Tim,



You could try changing the designer code to enclose them in square brackets, e.g. [Field Name]



Cheers, Peter
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Actually this will most likely not work due to the compiler nature of .NET.  This violates basic compiler rules. 

In this case you may be required to create a custom property without the hyphen or space and then pull that value out of the data table.  The data table should hold the original column name since it is weak typed.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
The square bracket thing isn't going to work (just tried it..boom). The issue with the custom properties is that the BO mapper will still map it incorrectly and anything I can think of fix that (like mapping to a dummy table) would break updates/inserts/deletes. I guess you could NOT map it and custom write what you need (i.e. all the custom properties, figure out what in the designer file you'd need to replicate)...but that seem like a huge pain.



If you have access to the database (i.e. you can add some other objects to it), you might consider a few things:



- Dummy tables that you map against and then sprocs for inserts/updates/deletes.



- You might have a "front-end" table that has an INSTEAD OF trigger, which in turn updates the actual table.



- An updatable view that you'd map against and then would allow updates/inserts/deletes.



Just throwing out some ideas. Not sure any fit your needs.
Tim Dol
Tim Dol
StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)StrataFrame User (434 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
Thanks guys, I went with the option of creating the structure in the toolkit and then using a SP to extract the data using Aliases for the problem fields. Worked Perfectly.



Thanks,

Tim

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Cool Cool
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search