Any ideas?

static string strconn = "SERVER=4.443.1.9;User=434AD;password=dfdew432f1F;Database=" + PortalSettingstxt1.Text();

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.