I have a class library where i get the data i need for the combobox which is
public List<Consoles> fillConsole()
{
var consoles = new List<Consoles>();
if (!DatabaseConnection.IsOpen)
{
DatabaseConnection.Open();
}
OracleCommand cmd = new OracleCommand();
cmd.Connection = DatabaseConnection.Connection;
string str = "SELECT consolename FROM Console";
cmd.CommandText = str;
OracleDataReader dr = cmd.ExecuteReader();
List<String> list = new List<string>();
while (dr.Read())
{
var console = new Consoles();
console.ConsoleName = dr["Consolename"].ToString();
consoles.Add(console);
}
DatabaseConnection.Close();
return consoles;
}
i would like to know how i could add this data to the combo box in my form when the page is loaded all i seem to get in the combobox is either collection or System.Collections.Generic.List`1[ClassLibraryGameSite.Consoles
If my fill code is wrong also could someone please tell me what thanks.
Console Class:
public class Consoles
{
private int consoleId;
private String consoleName;
public String ConsoleName
{
get { return consoleName; }
set { consoleName = value; }
}
public int ConsoleId
{
get { return consoleId; }
set { consoleId = value; }
}
}