Hi Guys, I'm hoping you can offer some advice on an issue i'm having with a datagrid populated from a database with a bindingsource.
DBConnect DBCon = new DBConnect();
string strSqlAO = "SELECT order_id AS 'Order', store_name AS 'Store Name', customer_id AS 'Customer ID', firstname AS 'First Name', lastname AS 'Last Name', email, telephone AS 'Tel', shipping_postcode AS 'Shipping Postcode', shipping_method AS 'Shipping Method', payment_method AS 'Payment Method', total AS 'Total', currency_code AS 'Currency', date_added AS 'Date Added', order_status_id FROM order ORDER BY date_added DESC";
//set the BindingSource DataSource
bSourceAO.DataSource = DBCon.GetData(strSqlAO);
//set the DataGridView DataSource
dgAllOrders.DataSource = bSourceAO;
The datagrid contains customers details and their order numbers from a table called 'order'. I can filter this datagrid to remove customers so my 'end result/view' is different to the actual data originally pulled from the database. (50 orders pulled into datagrid view but may only end up with 10 orders)
The 'order' table contains an 'order_id' field and the products purchased are in another table called 'order_products' and linked via the 'order_id'.
Once my datagrid is filtered I need to be able to produce a 'batch packing list' of the products ordered by the customers left in the datagrid only. I need the packing list to only show the product once but with the actual times that product was purchased.
ie: 3 of the customers left in the datagrid purchase 'Product A' so I need my packing list to show 'Product A = 3'.
I cant get my head around the best approach and don't want to start with this problem until I have at least a clear idea of the best approach.
Any ideas how to achieve this?
Thanks.
Sarah
Loading
Sam HobbsPosted Feb 4, 2012, 3:07 PM
Sarah ReynoldsPosted Feb 4, 2012, 11:51 AM
Sam HobbsPosted Feb 3, 2012, 5:10 PM
I think a WPF application typically uses a datagrid instead of a DataGridView.
Theoretically, since IIS only executes in Windows and ASP.Net applications typically execute in IIS, you could say that ASP.Net applications are Windows applications.
There are separate forums here for ASP.Net, Windows Forms, WPF and databases. Members have a tendency to lump everything into the C# language (this) forum. It would help to try to use the relevant forum.
There are a few ways to create an application with data bound to the UI. There are two relevant questions. First, can you retrieve all relevant data by joining the tabes (and filtering)? Second, do you need to be able to update the data or do you only need to show the data?
Do you know how to use the Entity Framework?
Sarah ReynoldsPosted Feb 3, 2012, 11:39 AM