Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2007

Tip: Looking for answers? Try searching our database.

saving object properties in sqlserver

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff User - 01 Apr 2007 22:38 GMT
Hi
Using vs2003 and sql server 2000

I would like ot save asp.net object attrributes such as alignment for
a table cell, in sql server database.
In my C# code I ahve to declare this as a HorizontalAlign type. then I
give my variable the value "HorizontalAlign.Center". Now I can set the
cell Horizontal align property to this variable.

Is there  way to save these special "types" in sql server, since I
could not just appply the word "left" (for example) to the table cell
Horizontal align attribute.

Thanks
jeff
Göran Andersson - 02 Apr 2007 17:29 GMT
> Hi
> Using vs2003 and sql server 2000
[quoted text clipped - 11 lines]
> Thanks
> jeff

You can cast the enum value to an int, and save in the database. When
you read the int from the database, you can cast it back to the enum value.

Example of casting:

// you have an enum value:
HorizontalAlign align = HorizontalAlign.Center;
// cast it to an integer:
int alignValue = (int)align;
// cast it back to the enum value:
HorizontalAlign align2 = (HorizontalAlign)alignValue;

Signature

Göran Andersson
_____
http://www.guffa.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.