ComboBox problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • FooFighter
    New Member
    • Apr 2009
    • 13

    ComboBox problem

    Hi all. I am using VS2008 Pro. I have a simple DVD database built. I'm trying to make a data driven app to store my dvd collection.

    One of my tables is Actors and is structured as follows.

    ActorID - int - PK
    LastName - varchar(20)
    FirstName - varchar(20)

    On a form in my app I have a combobox. I'm trying to make it list FirstName LastName ie. Will Smith. I know how to make a query that'll take the LastName and FirstName fields and list it as Actor. I'm having a heck of a time getting it to do that in the combobox as it'll only let me use one field for the display and won't let me use the query I've made...

    Code:
    SELECT FirstName + ' ' + LastName AS Actor
    FROM Actors
    ORDER BY LastName
    I keep getting some error about schema don't match default query. I know I could simply change the table to only have one field that holds first and last name, but from what I understand that's not proper db practice. I've searched this site and google until I was blue in the face at looking at soulutions that don't match what I'm trying to do. Does anyone know of a trick to do this?
  • searockruz
    New Member
    • May 2009
    • 7

    #2
    can you post your code,so that i can help you

    Comment

    • FooFighter
      New Member
      • Apr 2009
      • 13

      #3
      It's not really a code problem. It's actually a problem knowing which buttons to push (so-to-say) to get the result I want. I actually figured it out, but deleted the project where I was testing thinking I'd get back to it the next day. Then work happened bla. Been out of town for 2 weeks and can't remember what I did. Anyway I'll figure it out again.

      I think I had to make a new view or something of the such in SQL Server then use that view to populate the combo box.

      Comment

      • daniel aristidou
        Contributor
        • Aug 2007
        • 494

        #4
        what you want to look at is the data binding properties of the combo box, when you are in design view. from here you can select which columns are shown, and which columns value will be used when using the combo box.

        Comment

        Working...