Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In visual studio create a SQL Server Express Database with two tables Start up Server Explorer to create a new database file Lab3.mdf Add two

In visual studio create a SQL Server Express Database with two tables

Start up Server Explorer to create a new database file Lab3.mdf

Add two tables to your database: Suppliers and Inventory

Add the columns to Suppliers and Inventory as shown:

Let SupplierId be the primary key of type int for the Suppliers table and set its Identity Specification (Is Identity) to Yes (increment by 1)

Let InventoryId be the primary key of type int for the Inventory table and set its Identity Specification (Is Identity) to Yes (increment by 1)

Note: by using the same column name SupplierId, Visual Studio's tools are smart enough to realize that SupplierId is a foreign key in Inventory.

Add records to Tables in a database

Add the records to the Suppliers table for three suppliers and to the Inventory table for five items in inventory:

Use GridView Data Controls to display table records

Add the HTML, GridView, and SqlDataSource controls to your Default.aspx page to

Display all the suppliers

Display the entire inventory

Allow the user to enter a quantity, click the "Get Reorder List" button, and display all items at or below the quantity entered

Validate user input before querying a database

Add validation controls to the "Get Reorder List" button to guard against the user entering illegal quantities.

Edit the GridView's EmptyDataTemplate so that if there are no items that need to be re-ordered (based on quantity), your GridView should display No items need to be re-ordered.

Use SqlDataSource design wizard to join two tables

Add an improved reorder list GridView to your Default.aspx page that displays just the product name, supplier name, and quantity for items that need to be re-ordered.

Note: The SqlDataSource design wizard's Query Builder can be used to help write SQL statements that perform a join on multiple tables in a database.

Add a new SqlDataSource control to your Default.aspx page

Configure the SqlDataSource to

Use the same lab3 connection string (same database) as before, click Next

Specify a custom SQL statement, click Next

Click the Query Builder button

Add both the Inventory and Suppliers tables to the Query builder, click Close

Click on the Columns in the database table you would like selected (ProductName, SupplierName, Quantity).

On Quantity Column Filter, type in <=@quantity where @quantity is a parameter to the query

Note:you can check your select query by clicking Execute Query. It should prompt you for the @quantity parameter.

Click Next, Click Next to get to Define Parameters

Identify your quantity text box control as the parameter source, set the default value to 0

Add another h3 header and GridView to your Default.aspx page to hold your improved reorder list

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_2

Step: 3

blur-text-image_3

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

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions

Question

What are the purposes of promotion ?

Answered: 1 week ago

Question

Can workers be trained in ethics? How? Defend your answer.

Answered: 1 week ago