Enums and SQL Server 2005


Author
Message
Peter Jones
Peter Jones
Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)Advanced StrataFrame User (718 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi,

We have a Enums class that contains all enums for the solution and some of these enum values actually make their way into the application database. In some queries it would be much better to show the 'text value' of an enum rather than it's integer value. Does anyone know if there is any way of doing such a thing in SQL Server 2005 now that CLR/managed code is supported? If there is can you point me to a reference or two.

Cheers, Peter

Reply
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
On your question on how to retrieve the localized value, you can do so by using either the System.Globalization.CultureInfo.CurrentCulture.LCID to get the locale ID (of course, this will get the locale ID of the server so you'll need to need to make sure to set the proper region within the control panel) or pass over the locale ID when you call the SPROC.  As for the problem with adding the references, you should be able to click the button at the top of the Solution Explorer that says "Show All Files."  After that, you should see a new node under the project that says References.  Right-clicking on it will allow you to add a new reference.  Hope that helps. 

Oh, and the error about the SQL Server connection string is becuase that connection string is used for debugging the stored procedures.  If you set the conn string, VS will attempt to deploy the DLL and attach the remote debugger so that you can step into your sprocs when they're called.

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