Beginner Question

Joined
Oct 11, 2006
Messages
2
Reaction score
0
I'm trying to connect to an Access database in ASP.NET 1.1. I'm using the following code:

Code:
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=calendar.mdb";
OleDbConnection myConnection = new OleDbConnection(connectionString);

I get the following error:

Code:
field initializer cannot reference the nonstatic field, method, or property 'ASP.CalendarTest_20070117_aspx.connectionString'

With the line that defines myConnection highlighted. I'm not sure what's wrong with my definition.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top