Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!