denotes a 'field' where a 'class' was expected
Hi all,
I have a little problem with the connection object. when I compile, it gave me error:
...CustomerManager.connection' denotes a 'field' where a 'class' was expected
I have no ideal why. I shoud be able to have a SqlConnection object as a field in CustomerManager class right? How can I fix this?
Thanks
John
1) I have ConnectionManager class have 1 public method that return an opened SqlConnection object
public class ConnectionManager {
public static SqlConnection getConnection() {
SqlConnection connection = new SqlConnection (SQL_CONNECTION_STRING_POOL);
connection.Open();
return connection;
}
}
2. I have another class call CustomerManager that have some methods
in this case , I just show 1 method: addCustomer.
public class CustomerManager {
SqlConnection connection = ConnectionManager.getConnection();
public static bool addCustomer(Customer cust) {
// codes here
//
//
line 100 SqlCommand command = new SqlCommand(sql, connection);
// code here
}
}
|