Click here to Skip to main content
15,901,122 members
Home / Discussions / C#
   

C#

 
GeneralRe: msbuild success/failure condition c# Pin
PIEBALDconsult6-Mar-12 7:21
mvePIEBALDconsult6-Mar-12 7:21 
GeneralRe: msbuild success/failure condition c# Pin
Dave Kreskowiak6-Mar-12 9:09
mveDave Kreskowiak6-Mar-12 9:09 
GeneralRe: msbuild success/failure condition c# Pin
PIEBALDconsult6-Mar-12 9:17
mvePIEBALDconsult6-Mar-12 9:17 
GeneralRe: msbuild success/failure condition c# Pin
Dave Kreskowiak6-Mar-12 9:24
mveDave Kreskowiak6-Mar-12 9:24 
GeneralRe: msbuild success/failure condition c# Pin
PIEBALDconsult6-Mar-12 9:40
mvePIEBALDconsult6-Mar-12 9:40 
GeneralRe: msbuild success/failure condition c# Pin
jschell6-Mar-12 8:39
jschell6-Mar-12 8:39 
AnswerRe: msbuild success/failure condition c# Pin
PIEBALDconsult6-Mar-12 7:11
mvePIEBALDconsult6-Mar-12 7:11 
QuestionBinding combo-box to Entity Data Model Pin
pmcm6-Mar-12 4:44
pmcm6-Mar-12 4:44 
Hi,

I'm trying to keep my data access code separate from the code behind my form. What I am trying to do is populate my combo-box with a list of CompanyNames here's how I'm trying to bind this combo-box to my Companies entity to retrieve the CompanyName:

C#
private void frmMain_Load(object sender, EventArgs e)
{
    dal = new DataAccessLayer();

    cmbCompanyNameSearch.DataSource = dal.GetcmbCompanyList();
}


and here's the method in my DataAccessLayer:
C#
public List<Companies> GetcmbCompanyList()
{
    // Check we have an ObjectContext
    if (entities == null) entities = new CompanySecretaryEntities();

        // Create a query from the entityset
    ObjectQuery<Companies> companies = entities.Companies;
    companies.MergeOption = MergeOption.AppendOnly;

    // Define the query
    var query = from c in entities.Companies
            select c.CompanyName;

    // Execute the query
    List<Companies> results = query.ToList();

    // Return the results in a List
    return results;
}

This is giving me the following error:
Error 1 Cannot implicitly convert type 'System.Collections.Generic.List<string>' to 'System.Collections.Generic.List<CompanySecretary.Companies

Can anyone point me in the correct direction? I know if I change select c.CompanyName; to be select c; removes the error message but I only want to select c.CompanyName in this instance
AnswerRe: Binding combo-box to Entity Data Model Pin
RobCroll6-Mar-12 10:48
RobCroll6-Mar-12 10:48 
GeneralRe: Binding combo-box to Entity Data Model Pin
pmcm6-Mar-12 22:37
pmcm6-Mar-12 22:37 
QuestionGetting information about a process's handles. Pin
Septimus Hedgehog6-Mar-12 2:09
Septimus Hedgehog6-Mar-12 2:09 
AnswerRe: Getting information about a process's handles. Pin
Eddy Vluggen6-Mar-12 5:20
professionalEddy Vluggen6-Mar-12 5:20 
AnswerRe: Getting information about a process's handles. Pin
Dave Kreskowiak6-Mar-12 5:35
mveDave Kreskowiak6-Mar-12 5:35 
GeneralRe: Getting information about a process's handles. Pin
Septimus Hedgehog6-Mar-12 6:50
Septimus Hedgehog6-Mar-12 6:50 
GeneralRe: Getting information about a process's handles. Pin
Septimus Hedgehog6-Mar-12 23:51
Septimus Hedgehog6-Mar-12 23:51 
QuestionHow do you enforce use of dedicated factories? Pin
GParkings6-Mar-12 0:07
GParkings6-Mar-12 0:07 
AnswerRe: How do you enforce use of dedicated factories? Pin
BobJanova6-Mar-12 0:40
BobJanova6-Mar-12 0:40 
GeneralRe: How do you enforce use of dedicated factories? Pin
GParkings6-Mar-12 1:01
GParkings6-Mar-12 1:01 
GeneralRe: How do you enforce use of dedicated factories? Pin
BobJanova6-Mar-12 1:58
BobJanova6-Mar-12 1:58 
GeneralRe: How do you enforce use of dedicated factories? Pin
GParkings6-Mar-12 2:30
GParkings6-Mar-12 2:30 
GeneralRe: How do you enforce use of dedicated factories? Pin
jschell6-Mar-12 8:54
jschell6-Mar-12 8:54 
AnswerRe: How do you enforce use of dedicated factories? Pin
Eddy Vluggen6-Mar-12 0:46
professionalEddy Vluggen6-Mar-12 0:46 
GeneralRe: How do you enforce use of dedicated factories? Pin
GParkings6-Mar-12 1:03
GParkings6-Mar-12 1:03 
AnswerRe: How do you enforce use of dedicated factories? Pin
Eddy Vluggen6-Mar-12 5:19
professionalEddy Vluggen6-Mar-12 5:19 
GeneralRe: How do you enforce use of dedicated factories? Pin
GParkings6-Mar-12 5:51
GParkings6-Mar-12 5:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.