[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 464
  • Last Modified:

How do populate a ContextMenuStrip control using data from a SQL Server 2008 database

I have a VS2010 C# Windows application, and I want to add a ContextMenuStrip control to the form. I want to populate the ContextMenuStrip control with data from tables within my SQL Server 2008 database.For example, my ContextMenuStrip will have three menuitems: Projects, Deliverables, and Times. Under each of these items, I want to pull data from the database, and add the data to each menuitem. For Projects, the data will be pulled from "SELECT * FROM dbo.Projects", for Deliverables, the data will be pulled from "SELECT * FROM dbo.Tasks", and for Times, the data will be pulled from "SELECT * FROM dbo.WeekEndingDates". How would I go about doing? Another question I have is: once these menuitems are populated, is there a way to change them upon user selection? For example, if a user selects "Project 1" under the Projects menuitem, can the Deliverables menuitem be repopulated with all the data from the database that is associated with "Project 1"? Example: User selects "Project 1" from Projects menuitem, and then the Deliverables menuitem is populated with "SELECT * FROM dbo.Tasks WHERE Project = 'Project 1'".
1 Solution

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now