我正在为我的学习开发一个应用程序。现在我刚刚启动了一个应用程序,其中我有一个包含足球联赛和俱乐部等的数据库。现在我有一个俱乐部列表,现在我试图添加更多联赛的球员,然后只有 1 个。但是当我收到这个错误时做同样的事情然后做之前。这是无效列表的代码:
public List<Competitie> GetAllCompetities()
{
List<Competitie> Competitie = new List<Competitie>();
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
connection.Open();
string query = "Select * from competitie";
MySqlCommand selectallcompetitiecommand = new MySqlCommand(query, connection);
MySqlDataReader reader = selectallcompetitiecommand.ExecuteReader();
while (reader.Read())
{
Competitie comp = new Competitie();
comp.IdCompetitie = reader.GetInt32(0);
comp.NaamCompetitie = reader.GetString(1);
Competitie.Add(comp);
}
}
return Competitie;
}
然后这是正在工作的俱乐部的代码:
public List<Clubs> GetAllClubs(string selecteditem)
{ //Zorgt voor alle dingen van de tabel clubs.
List<Clubs> Clubs = new List<Clubs>();
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
connection.Open();
string query = "Select * from databasevoetbal.clubs where competitie.naamcompetie = '" + selecteditem + "' and clubs.idcompetitie =
这是相同的代码,只有俱乐部中的查询使用列表框中的选定项目,但任何人都知道为什么我在第一个列表中收到此错误:
错误 CS0050 可访问性不一致:返回类型“ List<Competitie>”比方法“ DatabaseManager.GetAllCompetities()”更难访问
慕田峪7331174
相关分类