Godis63
Member
- Joined
- Jun 7, 2024
- Messages
- 6
- Programming Experience
- 1-3
Greetings to all Forum members.
I am designing a sales database in C# Windows Form Application where I need to create a stored procedure to relate the stock and sales tables to each other.
In the project I have textboxes named “grossStockQty” from the stock table, “grossSalesQty” from the sales table and “AvailableQty” on the stored procedure form, respectfully.
I used the following code to sum up record from the “stockQty” in the stock table into the “grossStockQty” textbox:-
grossStockQtyTextBox.Text = (from DataGridViewRow row in stockDataGridView.Rows
where row.Cells[7].FormattedValue.ToString() != string.Empty
select Convert.ToDecimal(row.Cells[7].FormattedValue)).Sum().ToString();
I also used the following code to sum up record from the “salesQty” in the sales table into the “grossSalesQty” textbox:-
grossSalesQtyTextBox.Text = (from DataGridViewRow row in salesDataGridView.Rows
where row.Cells[17].FormattedValue.ToString() != string.Empty
select Convert.ToDecimal(row.Cells[17].FormattedValue)).Sum().ToString();
Now, on the Stored Procedure Form, I have created a textbox I want to subtract gross sales qty from the gross stock qty into the textbox named “AvailableQty”, but I am stuck.
Please, I will appreciate if someone can help me fix my problem.
Thanks.
I am designing a sales database in C# Windows Form Application where I need to create a stored procedure to relate the stock and sales tables to each other.
In the project I have textboxes named “grossStockQty” from the stock table, “grossSalesQty” from the sales table and “AvailableQty” on the stored procedure form, respectfully.
I used the following code to sum up record from the “stockQty” in the stock table into the “grossStockQty” textbox:-
grossStockQtyTextBox.Text = (from DataGridViewRow row in stockDataGridView.Rows
where row.Cells[7].FormattedValue.ToString() != string.Empty
select Convert.ToDecimal(row.Cells[7].FormattedValue)).Sum().ToString();
I also used the following code to sum up record from the “salesQty” in the sales table into the “grossSalesQty” textbox:-
grossSalesQtyTextBox.Text = (from DataGridViewRow row in salesDataGridView.Rows
where row.Cells[17].FormattedValue.ToString() != string.Empty
select Convert.ToDecimal(row.Cells[17].FormattedValue)).Sum().ToString();
Now, on the Stored Procedure Form, I have created a textbox I want to subtract gross sales qty from the gross stock qty into the textbox named “AvailableQty”, but I am stuck.
Please, I will appreciate if someone can help me fix my problem.
Thanks.