Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Display Authors Table App Modification) Modify the app in Section 22.5 to contain a Text- Box and a Button that allow the user to search

(Display Authors Table App Modification) Modify the app in Section 22.5 to contain a Text- Box and a Button that allow the user to search for specific authors by last name. Include a Label to identify the TextBox. Using the techniques presented in Section 22.9, create a LINQ query and change the DataSource property of authorBindingSource to contain only the specified authors. Also, provide a Button that enables the user to return to browsing the complete set of authors.

App in section 22.5:

Fig. 22.20: DisplayAuthorsTable.cs

// Displaying data from a database table in a DataGridView.

using System;

using System.Data.Entity;

using System.Data.Entity.Validation;

using System.Linq;

using System.Windows.Forms;

namespace DisplayTable

{

public partial class DisplayAuthorsTable : Form

{

// constructor

public DisplayAuthorsTable()

{

InitializeComponent();

} // end constructor

// Entity Framework DbContext

// load data from database into DataGridView

private void DisplayAuthorsTable_Load( object sender, EventArgs e )

{

// load Authors table ordered by LastName then FirstName

// specify DataSource for authorBindingSource

} // end method DisplayAuthorsTable_Load

// click event handler for the Save Button in the

// BindingNavigator saves the changes made to the data

private void authorBindingNavigatorSaveItem_Click(

object sender, EventArgs e )

{

// try to save changes

try

{

} // end try

catch( )

{

MessageBox.Show( "FirstName and LastName must contain values",

"Entity Validation Exception" );

} // end catch

} // end method authorBindingNavigatorSaveItem_Click

} // end class DisplayAuthorsTable

} // end namespace DisplayTable

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions

Question

What about leadership lessons from particularly good or bad bosses?

Answered: 1 week ago