Hi micah,
Refer the below sample query. You need to call the query in DropDownList selection to display the total quantity in TextBox for this use ExecuteScalar and passs the DropDownList SelectedText to SqlCommand Parameter. Refer the below article.
SQL
DECLARE @Inches AS TABLE (ID INT,UserName VARCHAR(50),Inches INT)
INSERT INTO @Inches VALUES(1,'dav44',1)
INSERT INTO @Inches VALUES(2,'dav44',2)
INSERT INTO @Inches VALUES(3,'dav44',3)
DECLARE @Category AS TABLE (ID INT,UserName VARCHAR(50),Category VARCHAR(50))
INSERT INTO @Category VALUES(1,'dav44','medium')
INSERT INTO @Category VALUES(2,'dav44','small')
INSERT INTO @Category VALUES(3,'dav44','larg')
DECLARE @BlockProduction AS TABLE
(
[ID] [int] IDENTITY(1,1) NOT NULL,
[UserName] [NVARCHAR](50) NULL,
[Item] [NVARCHAR](50) NULL,
[Inches] [NVARCHAR](50) NULL,
[Category] [NVARCHAR](500) NULL,
[Quantity] [FLOAT] NULL,
[ProductionDate] [DATE] NULL
)
INSERT INTO @BlockProduction VALUES('dav44','Item 1','1','medium',10,GETDATE())
INSERT INTO @BlockProduction VALUES('dav44','Item 1','1','small',20,GETDATE())
INSERT INTO @BlockProduction VALUES('dav44','Item 1','2','larg',30,GETDATE())
INSERT INTO @BlockProduction VALUES('dav44','Item 1','1','medium',40,GETDATE())
INSERT INTO @BlockProduction VALUES('dav44','Item 1','1','small',50,GETDATE())
DECLARE @Inch VARCHAR(20)
DECLARE @Cat VARCHAR(20)
SET @Inch = '1'
SET @Cat = 'small'
SELECT SUM(Quantity) 'total quantity'
FROM @BlockProduction
WHERE (Inches = @Inch OR @Inch IS NULL) AND (Category = @Cat OR @Cat IS NULL)
Output
total quantity
70