Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to create an enum datatype in ASP.NET?

Posted on 2008-11-19
8
Medium Priority
?
952 Views
Last Modified: 2013-11-07
Hi experts,

I wrote a code for a standard library some month before.
by the way the lib. connects to SQL databases.
For choosing which kind of SQL connection the programmer wishes to use, I used a enum type.
The code is below.

In Windows Forms and CommandLIne Apps this works great, but now I tried to create an ASP.NET website and the error (error message is attached) occures.

Where is the error?
class Database
{
 public enum ConnectionType
 {
  MSSQL,
  MySQL,
 }
 public ConnectionType Type { get; set; }
}

Open in new window

0
Comment
Question by:develc
8 Comments
 
LVL 41

Expert Comment

by:graye
ID: 22996997
...just kill the last comma in the list
public enum ConnectionType
{
  MSSQL,
  MySQL
}
 
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 22997038
Hi develc;

The syntax you are using is only supported in .Net Framework 3.5.

Fernand
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 22997079
Hi develc;

Try it like this.

class Database
{
    public enum ConnectionType
    {
        MSSQL,
        MySQL,
    }

    private ConnectionType _type;
    public ConnectionType Type
    {
        get { return _type; }
        set { _type = value;}
    }
}

Fernando
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:develc
ID: 22997097
I did... but the same error occures. I attached the library as a file...
The library.txt is the library.cs (just renamed it, because I was unable to upload it by this extension)
---> Mysql.Data.txt is MySql.Data.dll

1. just open a new ASP website,
2. include the library to the App_Code dir
3. add "using stdlib;" to the pagfefile you want to use
4. add MySql.dll as new Reference
5. start the page.
...

I'm unableto solve this error (It has nothing to do with the rest of the script)


library.zip
0
 
LVL 1

Author Comment

by:develc
ID: 22997135
@FernandoSoto: Thanks a lot! That worked.
I developed this library in Framework 2 and tested it on machines just running Framework until Version 2.
0
 
LVL 14

Expert Comment

by:jjardine
ID: 22997144
It looks like the error is referencing the Type property you created because it has not body to it.  The error regards not being an abstract or extern property.
0
 
LVL 1

Author Closing Comment

by:develc
ID: 31518380
Thank! Works fine.
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 22997171
Not a problem, glad I was of help.  ;=)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question