0

Any ideas?

static string strconn = "SERVER=4.443.1.9;User=434AD;password=dfdew432f1F;Database=" + PortalSettingstxt1.Text();
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Momerath
0

Static variables belong to the class, not an instance of the class. Whatever PortalSettingstxt1 is, it isn't a static class/class member. Since it needs an instance of a class to work, there is no way that the static string strconn can be initialized (which is done before class instances are created).

Thus, the error. Generally this issue is resolved by using the Singleton pattern.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.