NickMalloy
asked on
connection string code help
I can't figure out what is wrong with this code. The error is
A field initializer cannot reference the non-static field, method, or property 'clsKitInfo.connectionstri ng'
this code sits in a class file named clsKitInfo. The problem is this line
protected SqlConnection cn = new SqlConnection(connectionst ring);
A field initializer cannot reference the non-static field, method, or property 'clsKitInfo.connectionstri
this code sits in a class file named clsKitInfo. The problem is this line
protected SqlConnection cn = new SqlConnection(connectionst
protected string connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["SQLConnect"].ConnectionString;
protected clsconnect cnstr = new clsconnect();
protected SqlConnection cn = new SqlConnection(connectionstring);
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.