6 Months Free & No Setup Fees ASP.NET Hosting!
Skip Navigation Links
C# Corner Home
Forum Home
Latest 50
Unanswered
Win Prizes
All Time Leaders
Jump to CategoryExpand Jump to Category
Login 
    Welcome Guest!
 Search Forum For :  
X
 Login
Please login to submit a new post, reply and edit exiting posts, see user profiles, and access more features. If you are not a registered member, Register here.
User Id / Email:
Password:  
Forgot Password | Forgot UserName
   Home » C# Language » Best Approach?
       
Author Reply
Sarah Reynolds
posted 18 posts
since Jan 22, 2012 
from

Best Approach?

  Posted on: 03 Feb 2012       
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




Sarah Reynolds
posted  18 posts
since  Jan 22, 2012 
from 

 Re: Best Approach?
  Posted on: 03 Feb 2012        0  
PS:Sorry I forgot to add that this is a windows app. Thanks Sarah
Sam Hobbs
posted  6490 posts
since  Sep 07, 2009 
from  Los Angeles, California, USA

 Re: Best Approach?
  Posted on: 03 Feb 2012        0  
Is this for an ASP.Net application? The resaon I say is because you say datagrid. Windows Forms applications usually use a DataGridView.

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?
Thinking is a feeling; pleasant for some and unpleasant for others.
Sarah Reynolds
posted  18 posts
since  Jan 22, 2012 
from 

 Re: Best Approach?
  Posted on: 04 Feb 2012        0  
Hi Guys, I managed to sort this. It was just a case of tweaking the sql statement slightly to use a couple of sql functions. Sarah
Sam Hobbs
posted  6490 posts
since  Sep 07, 2009 
from  Los Angeles, California, USA

 Re: Best Approach?
  Posted on: 04 Feb 2012        0  
Good. Sorry for the lecture. It is often frustrating to be in the situation of wanting to help but unable to. As a regular to these forums and others, it happens to me every day and it has been happening for me for many years.
Thinking is a feeling; pleasant for some and unpleasant for others.
       
6 Months Free & No Setup Fees ASP.NET Hosting!
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Site Map  |  Advertise with us
Current Version: 5.2011.3.12
 © 1999 - 2012  Mindcracker LLC. All Rights Reserved