Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in C# using Microsofy Visual Studio. northwind.mdf . northwind _ log . ldf OrderDetailsMaintenance.zip 1 . Include the two above files in the root

Code in C# using Microsofy Visual Studio. northwind.mdf.
northwind_log.ldf
OrderDetailsMaintenance.zip
1. Include the two above files in the root of your OrderDetailsMaintenance project.
2. Make sure to mark them as "Content" and "Copy Always" or "Copy if newer" in the properties window of those two files.
3. Run the Scaffold-DbContext command to create a context class as well as a class to encapsulate the Orders objects from the associated table in the mdf file. Make sure to include the parameters for -Tables Customers (only worry about the attributes associated with the text boxes, you don't need to worry about any other rows from the table)
4. Once you have ran the command, include an app.config file and add a connection string element. Make sure to copy the connection string from your Context class to your app.config. Then edit your context to grab the connection string from the app.config (ConfigurationManager.ConnectionString["Northwind"].ConnectionString)
5. Code the Find button to Find the customer id and populate the details in the below text boxes.
1. If no order is found, display a message box.
6. Code the exit button
7. Code the Save button to update its attributes and call Update and SaveChanges() on that particular entity.
1. Note: If you close the program, reopen it, and search for the entity you recently updated. You may not see the changes depending on how you setup the mdf file in your project (because it copies a new version to the bin directory each time you run the program). So, if you don't see your changes, don't be alarmed. PLEASE GET THE RIGHT CODING FOR THE FIND BUTTON and SAVE BUTTON RELATING TO THE DATABASE Northwind.mdf. The code must match or it will not excute correctly at all. PLEASE AND THANK YOU. I found a other solution where this code shown: using (var context = new NorthwindContext())
{
var customer = context.Customers.FirstOrDefault(c => c.CustomerID == txtCustomerID.Text);
if (customer == null)
{
MessageBox.Show("Customer not found", "Find Customer", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
txtCompanyName.Text = customer.CompanyName;
txtContactName.Text = customer.ContactName;
txtContactTitle.Text = customer.ContactTitle;
txtAddress.Text = customer.Address;
txtCity.Text = customer.City;
txtRegion.Text = customer.Region;
txtPostalCode.Text = customer.PostalCode;
txtCountry.Text = customer.Country;
txtPhone.Text = customer.Phone;
txtFax.Text = customer.Fax;
} THIS WAS IN INCORRECT CODE I Had ERROR
image text in transcribed

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

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions