Reputation: 13382
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! ^_^
Upvotes: 0
Views: 217
Reputation: 1504102
The staticness and non-staticness are almost certainly irrelevant - although it would help if you could show us how you're trying to use it.
Is this in ASP.NET, by any chance? I wonder whether it's to do with the way that ASP.NET ends up being built, and what code lives where. Could you give us more details?
Upvotes: 0
Reputation: 56984
Where does the error occur ? Is the SQLUserDataManager class in another namespace then the class where you refer to SQLUserDataManager ?
Upvotes: 1