How to create an enum datatype in ASP.NET?

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

LVL 1
develcAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

grayeCommented:
...just kill the last comma in the list
public enum ConnectionType
{
  MSSQL,
  MySQL
}
 
0
Fernando SotoRetiredCommented:
Hi develc;

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

Fernand
0
Fernando SotoRetiredCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

develcAuthor Commented:
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
develcAuthor Commented:
@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
jjardineCommented:
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
develcAuthor Commented:
Thank! Works fine.
0
Fernando SotoRetiredCommented:
Not a problem, glad I was of help.  ;=)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.