My database, db, has like a primary key 'Artist' with foreign key 'CdTitle', in a single form a person can enter information to increase the database, in another form, I've got a combobox that I wish to populate using the names from the artist within the database, mainly 'Artist.Names' I have attempted utilizing a LINQ to traverse the database and set the outcomes from the query in to the combobox but it is no longer working like i figured.

the code I've is :

var ArtistNames = 
    from name in formByArtist.db.Artists    
    select name.Name;

foreach (var element in ArtistNames)

Suposing your Artist possess a Title as well as an Id, this can be done:

comboBox1.DataValueField = "Id";
comboBox1.DataTextField = "Name";

comboBox1.DataSource = formByArtist.db.Artists;

Out of your existing sample, modify the following:

var ArtistNames = 
    (from name in formByArtist.db.Artists    
     select name.Name)

comboBox1.DataSource = ArtistNames;