Search code examples
c#staticstatic-classes

Odd Static Class Issue


Below is my very simple static class. Not sure what is wrong. I am using it in a non static class that has a correct "using" statement. Intellisense sees the class and its one method.

I am getting the error

The name 'SQLUserDataManager' does not exist in the current context".

public static class SQLUserDataManager
    {
        public static SqlConnection connection;
        private static bool connectionMade;

        static SQLUserDataManager()
        {


        }

        public static void SpecifyConnection(string username, string password, string database)
        {

            string connectionString = "user id=" + username +
                                        ";password=" + password + ";server=127.0.0.1" +
                                        ";Trusted_Connection=yes" +
                                        ";database=NetunityUsers" +
                                        ";connection timeout=30";

        }
    }

Update: This is the line I am using it in.

 SQLUserDataManager.SpecifyConnection("admin", "password", "Users");

Problem Solved

I have a DLL that includes the file that was having errors compiling. In this DLL I had yet to include my new file which contains this file. I included the file and all is good! ^_^


Solution

  • Where does the error occur ? Is the SQLUserDataManager class in another namespace then the class where you refer to SQLUserDataManager ?