简体   繁体   中英

How can I make my Windows Form to do and display my database query?

I have 3 Tables:

  • Titles:

    • TitleId (int 6, primary key)
    • TitleName (varchar 50)
  • Authors :

    • AuthorId (int 6, primary key)
    • AuthorName (varchar 50)
  • AuthorsTitles (this is a junction table for Titles and Authors)

    • TitleId (int 6)
    • AuthorId (int 6)

There's a "many to many" relation: A Title may have many Authors, and an Author may have many Titles. This is why I need the junction table.

All I want is to get a Windows form with a ComboBox with Titles. The user selects a Title, and the Author or Authors of the selected Title will be listed in a ListBox .

I'm using Microsoft Visual C# Express Edition 2008 and SQL Server Express Edition 2008.

I don't have sample code but hope this link helps you.

Data Binding in .NET / C# Windows Forms

To set up a database connection in Visual Studio, see this .

For examples on how to bind a combobox to a field in a table, view this .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM