OleDbConnectionStringBuilder.sConnection is a 'field' but is used like a 'type'

I am trying to connect to my database, and this is what I have typed:

string sConnection;
sConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" +
                               "Data Source=Cars.accdb;"

but, the error message it gives me is:

Invalid token '=' in class, struct, or interface member declaration

as well as:

Error '...OleDbConnectionStringBuilder.sConnection' is a 'field' but
is used like a 'type'

I did use these using statements as well:

using System.Data.OleDb;
using System.Data;

using System.Object;
using System.Data.Common.DbConnectionStringBuilder; 
using System.Data.OleDb.OleDbConnectionStringBuilder;

namespace FinalProject
    class DataAccessLayer
        public sealed class OleDbConnectionStringBuilder : DataAccessLayer

            public OleDbCommand dbCmd; //Command object
            public OleDbDataReader dbReader; //Data Reader object

            string sConnection;
            sConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" +
                               "Data Source=Cars.accdb;";

Can you help me figure out why I am receiving these errors?

1 answer

You are having code in the class declaration that could only go in methods.

string sConnection;
sConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=Cars.accdb;";

is not ok in class declaration. Only in method.

This would be ok in class declaration:

string sConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=Cars.accdb;";